tor-browser

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

self-urn-navigation.https.html (1262B)


      1 <!DOCTYPE html>
      2 <title>Test that fenced frame-initiated self urn navigations fail.</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="/common/dispatcher/dispatcher.js"></script>
      7 <script src="resources/utils.js"></script>
      8 
      9 <body>
     10 <script>
     11 function getTimeoutPromise(t) {
     12  return new Promise(resolve =>
     13      t.step_timeout(() => resolve("NOT LOADED"), 2000));
     14 }
     15 
     16 // A fenced frame root should not be able to navigate itself to a urn:uuid.
     17 promise_test(async t => {
     18  const frame = attachFencedFrameContext();
     19  urn = await runSelectURL(frame.src);
     20 
     21  // Send the urn:uuid to the fenced frame over the network, and attempt to
     22  // self-"refresh" to that urn.
     23  await frame.execute(async (urn) => {
     24    window.executor.suspend(() => {
     25      location.href = urn;
     26    });
     27  }, [urn]);
     28 
     29  // The navigation should fail as intended.
     30  const urn_load_success_promise = frame.execute(() => {});
     31  const urn_load_failure_promise = getTimeoutPromise(t);
     32  const result =
     33    await Promise.any([urn_load_success_promise, urn_load_failure_promise]);
     34  assert_equals(result, "NOT LOADED");
     35 }, 'fenced frame-initiated self urn navigation');
     36 </script>
     37 </body>