4 https://bugzilla.mozilla.org/show_bug.cgi?id=372964
7 <title>Test for Bug
372964</title>
8 <script type=
"text/javascript" src=
"/MochiKit/MochiKit.js"></script>
9 <script type=
"text/javascript" 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=372964">Mozilla Bug
372964</a>
15 <div id=
"content" style=
"display: none">
19 <script class=
"testbody" type=
"text/javascript">
21 /** Test for Bug
372964 **/
25 function listener(evt) {
30 var ifr = document.getElementsByTagName(
"iframe")[
0];
31 var xhr = new ifr.contentWindow.XMLHttpRequest();
32 xhr.addEventListener(
"foo", listener, false);
33 var event = ifr.contentDocument.createEvent(
"Events");
34 event.initEvent(
"foo", true, true);
35 xhr.dispatchEvent(event);
36 is(eventCount,
1,
"Should have handled an event");
37 ifr.contentDocument.open();
38 ifr.contentDocument.close();
39 event = ifr.contentDocument.createEvent(
"Events");
40 event.initEvent(
"foo", true, true);
41 xhr.dispatchEvent(event);
43 "Shouldn't have handled an event because the context has changed");
47 SimpleTest.waitForExplicitFinish();
48 addLoadEvent(runTest);