Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / base / test / test_bug372964-2.html
blobb9d87c82d105fc42e69c27e85d4fffb0935fdd95
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=372964
5 -->
6 <head>
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" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=372964">Mozilla Bug 372964</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
17 </div>
18 <pre id="test">
19 <script class="testbody" type="text/javascript">
21 /** Test for Bug 372964 **/
23 var eventCount = 0;
25 function listener(evt) {
26 ++eventCount;
29 function runTest() {
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);
42 is(eventCount, 1,
43 "Shouldn't have handled an event because the context has changed");
44 SimpleTest.finish();
47 SimpleTest.waitForExplicitFinish();
48 addLoadEvent(runTest);
50 </script>
51 </pre>
52 <iframe>
53 </body>
54 </html>