dom/events/test/test_bug322588.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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">
    20 </div>
    21 <pre id="test">
    22 <script type="application/javascript">
    24 /** Test for Bug 322588 **/
    26 var result = "";
    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 }
    37 function doTest() {
    38   try {
    39     sendMouseEvent({type:'click'}, 'link');
    40   } catch(e) {
    41     if (w)
    42       w.close();
    43     throw e;
    44   }
    45 }
    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 }
    54 SimpleTest.waitForExplicitFinish();
    55 addLoadEvent(doTest);
    58 </script>
    59 </pre>
    60 </body>
    61 </html>

mercurial