dom/events/test/test_bug322588.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:163f1dae23ec
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=322588
5 -->
6 <head>
7 <title>Test for Bug 322588 - onBlur window close no longer works</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.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=322588">Mozilla Bug 322588 - onBlur window close no longer works</a>
14 <p id="display">
15 <a id="link" href="javascript:pop350d('bug322588-popup.html#target')">Openwindow</a><br>
16 The opened window should not directly close when clicking on the Openwindow link
17 </p>
18 <div id="content" style="display: none">
19
20 </div>
21 <pre id="test">
22 <script type="application/javascript">
23
24 /** Test for Bug 322588 **/
25
26 var result = "";
27
28 var w;
29 function pop350d(url) {
30 w = window.open();
31 w.addEventListener("unload", function () { result += " unload";}, false);
32 w.addEventListener("load", function () { result += " load"; setTimeout(done, 1000);}, false);
33 w.addEventListener("blur", function () { result += " blur";}, false);
34 w.location = url;
35 }
36
37 function doTest() {
38 try {
39 sendMouseEvent({type:'click'}, 'link');
40 } catch(e) {
41 if (w)
42 w.close();
43 throw e;
44 }
45 }
46
47 function done() {
48 is(result," unload load","unexpected events"); // The first unload is for about:blank
49 if (w)
50 w.close();
51 SimpleTest.finish();
52 }
53
54 SimpleTest.waitForExplicitFinish();
55 addLoadEvent(doTest);
56
57
58 </script>
59 </pre>
60 </body>
61 </html>

mercurial