tor-browser

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

entry.html (1374B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Entry settings object for host functions</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/wasm/jsapi/wasm-module-builder.js"></script>
      7 <script src="/wasm/jsapi/functions/helper.js"></script>
      8 
      9 <!-- This is the entry page, so window.open() should resolve relative to it, even inside host functions. -->
     10 
     11 <iframe src="resources/entry-incumbent.html"></iframe>
     12 
     13 <script>
     14 setup({ explicit_done: true });
     15 
     16 const relativeURL = "resources/window-to-open.html";
     17 const expectedURL = (new URL(relativeURL, location.href)).href;
     18 
     19 const incumbentWindow = frames[0];
     20 
     21 window.onload = () => {
     22  async_test(t => {
     23    const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL);
     24    w.onload = t.step_func_done(() => {
     25      t.add_cleanup(() => w.close());
     26      assert_equals(w.location.href, expectedURL);
     27    });
     28  }, "Sanity check: this all works as expected synchronously");
     29 
     30  async_test(t => {
     31    // No t.step_func because that could change the realms
     32    call_later(() => {
     33      const w = incumbentWindow.runWindowOpenVeryIndirectly(relativeURL);
     34      w.onload = t.step_func_done(() => {
     35        t.add_cleanup(() => w.close());
     36        assert_equals(w.location.href, expectedURL);
     37      });
     38    });
     39  }, "Start function");
     40 
     41  done();
     42 };
     43 </script>