gecko-dev/dom/bindings/test/test_exception_options_from_jsimplemented.html
2015-03-27 13:08:46 -07:00

74 lines
2.7 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1107592</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1107592 **/
SimpleTest.waitForExplicitFinish();
function doTest() {
var t = new TestInterfaceJS();
try {
t.testThrowDOMError();
} catch (e) {
ok(e instanceof Error, "Should have an Error here");
ok(!(e instanceof DOMException), "Should not have DOMException here");
ok(!("code" in e), "Should not have a 'code' property");
ise(e.name, "Error", "Should not have an interesting name here");
ise(e.message, "We are a DOMError", "Should have the right message");
ise(e.stack,
"doTest@http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html:20:7\n",
"Exception stack should still only show our code");
ise(e.fileName,
"http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html",
"Should have the right file name");
ise(e.lineNumber, 20, "Should have the right line number");
ise(e.columnNumber, 6, "Should have the right column number");
}
try {
t.testThrowDOMException();
} catch (e) {
ok(e instanceof Error, "Should also have an Error here");
ok(e instanceof DOMException, "Should have DOMException here");
ise(e.name, "NotSupportedError", "Should have the right name here");
ise(e.message, "We are a DOMException",
"Should also have the right message");
ise(e.code, DOMException.NOT_SUPPORTED_ERR,
"Should have the right 'code'");
ise(e.stack,
"doTest@http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html:38:7\n",
"Exception stack should still only show our code");
ise(e.filename,
"http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html",
"Should still have the right file name");
ise(e.lineNumber, 38, "Should still have the right line number");
todo_is(e.columnNumber, 7,
"No column number support for DOMException yet");
}
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]},
doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107592">Mozilla Bug 1107592</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>