tor-browser

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

history-length-outer-page-navigation-not-reflected-in-fenced-nested-iframe.https.html (2127B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="resources/utils.js"></script>
      5 <script src="resources/history-length-test-helper.js"></script>
      6 <script src="/common/utils.js"></script>
      7 <title>Test iframes in fenced frames can't see outer page history length</title>
      8 
      9 <body>
     10 <script>
     11 promise_test(async () => {
     12  const kAssertionDesc =  "history.length Should never reflect the length " +
     13                          "of joint session history that occured outside " +
     14                          "of the fenced frame tree. history.length will " +
     15                          "always return 1."
     16 
     17  maybeNavigateForHistory();
     18 
     19  const fenced_history_length_key = token();
     20  const outer_page_ready_for_next_navigation_key = token();
     21 
     22  // Append an iframe to the outer page for subsequent navigations within
     23  // the iframe
     24  const iframe = document.createElement('iframe');
     25  const embed_scope_iframe = "outer_page::iframe";
     26  iframe.src = generateURL("resources/history-length-outer-page-navigation-" +
     27      "not-reflected-in-fenced-inner.html",
     28      [fenced_history_length_key, outer_page_ready_for_next_navigation_key,
     29       embed_scope_iframe, null]);
     30  document.body.append(iframe);
     31 
     32  await nextValueFromServer(outer_page_ready_for_next_navigation_key);
     33 
     34  // Append a fenced frame to observe 'history.length' and report it back
     35  // to the outer page
     36  const embed_scope_fenced_frame = "outer_page::fenced_frame";
     37  attachFencedFrame(generateURL(
     38      "resources/history-length-outer-page-navigation-" +
     39      "not-reflected-in-fenced-inner.html",
     40      [fenced_history_length_key, outer_page_ready_for_next_navigation_key,
     41       embed_scope_fenced_frame, "outer_page::fenced_frame::iframe"])
     42  );
     43 
     44  // Wait for the fenced frame to report 'history.length'
     45  let result = await nextValueFromServer(fenced_history_length_key);
     46  assert_equals(result, "PASS > " + " history.length: 1", kAssertionDesc);
     47 }, "history.length should not reflect navigations within outer page in " +
     48  "an iframe nested within a fenced frame");
     49 </script>
     50 </body>