tor-browser

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

navigate-navigation-back-same-document-in-iframe.html (1473B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <iframe id="i" src="/common/blank.html"></iframe>
      5 <script>
      6 promise_test(async t => {
      7  // Wait for after the load event so that the navigation doesn't get converted
      8  // into a replace navigation.
      9  await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
     10 
     11  let target_key = i.contentWindow.navigation.currentEntry.key;
     12  let target_id = i.contentWindow.navigation.currentEntry.id;
     13  await i.contentWindow.navigation.navigate("#").finished;
     14  assert_true(i.contentWindow.navigation.canGoBack);
     15 
     16  i.contentWindow.navigation.onnavigate = e => {
     17    assert_equals(e.navigationType, "traverse");
     18    assert_false(e.cancelable, "traversals in iframes should never be cancelable");
     19    assert_true(e.canIntercept);
     20    assert_false(e.userInitiated);
     21    assert_true(e.hashChange);
     22    assert_equals(e.downloadRequest, null);
     23    assert_equals(new URL(e.destination.url).hash, "");
     24    assert_true(e.destination.sameDocument);
     25    assert_equals(e.destination.key, target_key);
     26    assert_equals(e.destination.id, target_id);
     27    assert_equals(e.destination.index, 0);
     28    assert_equals(e.formData, null);
     29    assert_equals(e.info, "hi");
     30    assert_equals(e.sourceElement, null);
     31  }
     32  await i.contentWindow.navigation.back({ info: "hi" }).finished;
     33 }, "navigate event for navigation.back() - same-document in an iframe");
     34 </script>