tor-browser

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

print-during-beforeunload.html (863B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>print() during beforeunload</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <body>
      8 <script>
      9 "use strict";
     10 
     11 async_test(t => {
     12  const w = window.open("resources/print-during-event.sub.html?event=beforeunload");
     13  t.add_cleanup(() => w.close());
     14 
     15  const messages = [];
     16  window.addEventListener("message", t.step_func(({ data }) => {
     17    messages.push(data);
     18 
     19    if (messages.length === 1) {
     20      assert_array_equals(messages, ["start"]);
     21      w.location.href = "resources/destination.html";
     22    } else if (messages.length === 2) {
     23      // The test passes if we've reached this point because the print() dialog did not block the navigation.
     24      assert_array_equals(messages, ["start", "destination"]);
     25      t.done();
     26    }
     27  }));
     28 });
     29 </script>