tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug322588.html (1667B)


      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 src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script 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(url);
     31  w.addEventListener("unload", function () { result += " unload";});
     32  w.addEventListener("load", function () { result += " load"; setTimeout(done, 1000);});
     33  w.addEventListener("blur", function () { result += " blur";});
     34 }
     35 
     36 function doTest() {
     37  try {
     38    sendMouseEvent({type:'click'}, 'link');
     39  } catch(e) {
     40    if (w)
     41      w.close();
     42    throw e;
     43  }
     44 }
     45 
     46 function done() {
     47  is(result," unload load","unexpected events"); // The first unload is for about:blank
     48  if (w)
     49    w.close();
     50  SimpleTest.finish();
     51 }
     52 
     53 SimpleTest.waitForExplicitFinish();
     54 SimpleTest.requestFlakyTimeout("untriaged");
     55 addLoadEvent(function() {
     56  SpecialPowers.pushPrefEnv({"set": [
     57    ["browser.newtab.preload", false]
     58  ]}, doTest);
     59 });
     60 
     61 
     62 </script>
     63 </pre>
     64 </body>
     65 </html>