4 https://bugzilla.mozilla.org/show_bug.cgi?id=748983
8 <title>Test for Bug
748983</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=748983">Mozilla Bug
748983</a>
15 <div id=
"content" style=
"display: none">
18 <script type=
"application/javascript">
20 /** Test for Bug
748983 **/
22 SimpleTest.waitForExplicitFinish();
25 ok(document instanceof EventTarget,
"document is an event target");
26 ok(new XMLHttpRequest() instanceof XMLHttpRequest,
"instanceof should work on XHR");
27 ok(HTMLElement.prototype instanceof Node,
"instanceof needs to walk the prototype chain");
29 var otherWin = document.getElementById(
"testFrame").contentWindow;
31 ok(otherWin.HTMLElement.prototype instanceof otherWin.Node,
"Same-origin instanceof of a interface prototype object should work, even if called cross-origin");
32 ok(!(otherWin.HTMLElement.prototype instanceof Node),
"Cross-origin instanceof of a interface prototype object shouldn't work");
34 // We need to reset HTMLElement.prototype.__proto__ to the original value
35 // before using anything from the harness, otherwise the harness code breaks
37 HTMLElement.prototype.__proto__ = otherWin.Element.prototype;
38 var [ shouldSucceed, shouldFail ] = otherWin.runTest();
39 shouldSucceed = shouldSucceed && HTMLElement.prototype instanceof otherWin.Element;
40 shouldFail = shouldFail && HTMLElement.prototype instanceof Element;
41 HTMLElement.prototype.__proto__ = Element.prototype;
43 ok(shouldSucceed,
"If an interface prototype object is on the protochain then instanceof with the interface object should succeed");
44 ok(!shouldFail,
"If an interface prototype object is not on the protochain then instanceof with the interface object should succeed");
51 <iframe id=
"testFrame" src=
"file_InstanceOf.html" onload=
"runTest()"></iframe>