gecko-dev/dom/tests/mochitest/bugs/test_bug291377.html

42 строки
1.3 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=291377
-->
<head>
<title>Test for Bug 291377</title>
<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=291377">Mozilla Bug 291377</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 291377 **/
/* Do something that causes an XPConnect exception */
var threw = true;
try {
document.appendChild(); /* Not enough arguments */
threw = false;
} catch (e) {
/* Check that we can touch various properties */
is(e.lineNumber, 23, "Unexpected line number"); //This line number is dependent on the line number of document.appendChild()
is(e.name, "NS_ERROR_XPC_NOT_ENOUGH_ARGS", "Unexpected exception name");
isnot(e.message, "", "Should have a message");
isnot(e.result, 0, "Should have a result");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
is(e.result, Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS);
}
is(threw, true, "Not enough arguments to a call should throw");
</script>
</pre>
</body>
</html>