tor-browser

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

select-url-saved-query-multi-frame.tentative.https.sub.html (2046B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/common/utils.js"></script>
      5 <script src="/common/get-host-info.sub.js"></script>
      6 <script src="/shared-storage-selecturl-limit/resources/utils.js"></script>
      7 <script src="/shared-storage/resources/util.js"></script>
      8 <script src="/fenced-frame/resources/utils.js"></script>
      9 
     10 <body>
     11 <script>
     12 'use strict';
     13 
     14 promise_test(async () => {
     15  // Note that we have set the site page bit limit to 3 and the overall page
     16  // bit limit to 6. A single saved query with 8 URLs (i.e. log2(8) = 3 bits)
     17  // will be permitted by a site's page budget, plus re-uses of the saved
     18  // query. Two saved queries with 8 URLs (and their re-uses) will be
     19  // permitted by the overall page budget.
     20  const queryKey = "query";
     21  const mockResultKey = "mockresult";
     22 
     23  let url0 = new URL(
     24      "/shared-storage-selecturl-limit/" +
     25      "resources/select-url-saved-query-multi-frame-inner.https.sub.html",
     26      location.href);
     27 
     28  url0.searchParams.append(queryKey, "query");
     29  url0.searchParams.append(mockResultKey, "1");
     30  await attachIFrameWithEventListenerForSelectURLStatus(url0);
     31 
     32  // The same origin can re-use the saved query with ths same name "query".
     33  await attachIFrameWithEventListenerForSelectURLStatus(url0);
     34 
     35  // The same saved query name "query" will refer to a different query when
     36  // used by a different origin, as evidenced by having a different index
     37  // result. Set a new index result for the iframe to send to selectURL.
     38  const crossOrigin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN;
     39  let url1 = updateUrlToUseNewOrigin(url0, crossOrigin);
     40  url1.searchParams.delete(mockResultKey);
     41  url1.searchParams.append(mockResultKey, "2");
     42  await attachIFrameWithEventListenerForSelectURLStatus(url1);
     43 
     44  // `crossOrigin` can re-use its own query from a separate frame.
     45  await attachIFrameWithEventListenerForSelectURLStatus(url1);
     46 
     47 }, 'selectURL() with saved queries across mutliple frames.');
     48 </script>
     49 </body>