tor-browser

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

test_bug635636.html (1742B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=635636
      5 -->
      6 <head>
      7  <title>Test for Bug 635636</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/EventUtils.js"></script>
     10  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=635636">Mozilla Bug 635636</a>
     14 <p id="display"></p>
     15 <div id="content">
     16 </div>
     17 <pre id="test">
     18 <script type="application/javascript">
     19 
     20 /** Test for Bug 635636 */
     21 SimpleTest.waitForExplicitFinish();
     22 addLoadEvent(async function() {
     23  function openNewWindow(aURL) {
     24    return new Promise(resolve => {
     25      let contentWindow = window.open(aURL);
     26      contentWindow.addEventListener("load", () => {
     27        ok(true, aURL + " is loaded");
     28        resolve(contentWindow);
     29      }, { once: true });
     30    });
     31  }
     32 
     33  function unloadWindow(aWindow) {
     34    return new Promise(resolve => {
     35      aWindow.addEventListener("unload", () => {
     36        ok(true, "The window has been unloaded");
     37        SimpleTest.executeSoon(() => { resolve(0); });
     38      }, { once: true });
     39      aWindow.location = "file_bug635636_2.html";
     40    });
     41  }
     42 
     43  let contentWindow = await openNewWindow("file_bug635636.xhtml");
     44 
     45  contentWindow.addEventListener("load", () => { ok(true, "load"); });
     46  contentWindow.addEventListener("pageshow", () => { ok(true, "pageshow"); });
     47 
     48  let div = contentWindow.document.getElementsByTagName("div")[0];
     49  contentWindow.document.designMode = "on";
     50 
     51  await unloadWindow(contentWindow);
     52 
     53  div.remove();
     54  ok(true, "Should not crash");
     55  // Not needed for the crash
     56  contentWindow.close();
     57  SimpleTest.finish();
     58 });
     59 
     60 </script>
     61 </pre>
     62 </body>
     63 </html>