gecko/dom/tests/mochitest/bugs/test_bug375457.html

62 lines
1.6 KiB
HTML

<!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>