зеркало из https://github.com/mozilla/pjs.git
Bug 375457 - "toDataURL has incorrect type-checking logic" (a simple test that just ensures we throw an exception when calling toDataURL with null and objects) [p=joe@drew.ca (Joe Drew [JOEDREW!])]
This commit is contained in:
Родитель
17c2171beb
Коммит
d876f2b812
|
@ -56,6 +56,7 @@ _TEST_FILES = \
|
|||
test_bug345521.html \
|
||||
test_bug351601.html \
|
||||
test_bug370098.html \
|
||||
test_bug375457.html \
|
||||
test_bug377539.html \
|
||||
test_bug384122.html \
|
||||
test_bug389366.html \
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=375457
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 375457</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=375457">Mozilla Bug 159849</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<canvas id="canvas" width="10" height="10"> </canvas>
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
var canvas = document.getElementById("canvas");
|
||||
|
||||
var dataURL = undefined;
|
||||
var exceptionThrown = false;
|
||||
|
||||
try {
|
||||
dataURL = canvas.toDataURL("image/png", null);
|
||||
} catch(err) {
|
||||
exceptionThrown = true;
|
||||
}
|
||||
|
||||
ok(exceptionThrown,
|
||||
"an exception should have been thrown with not-string encoder options");
|
||||
|
||||
ok(dataURL === undefined,
|
||||
"should not have been possible to get a data URL with not-string encoder options",
|
||||
"got " + repr(dataURL) + ", expected undefined");
|
||||
|
||||
dataURL = undefined;
|
||||
exceptionThrown = false;
|
||||
|
||||
try {
|
||||
dataURL = canvas.toDataURL("image/png", canvas);
|
||||
} catch(err) {
|
||||
exceptionThrown = true;
|
||||
}
|
||||
|
||||
ok(exceptionThrown,
|
||||
"an exception should have been thrown with not-string encoder options");
|
||||
|
||||
ok(dataURL === undefined,
|
||||
"should not have been possible to get a data URL with not-string encoder options",
|
||||
"got " + repr(dataURL) + ", expected undefined");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче