tor-browser

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

select-url-on-shared-storage-and-worklet-object-successively.tentative.https.sub.html (1841B)


      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="/shared-storage/resources/util.js"></script>
      6 <script src="/fenced-frame/resources/utils.js"></script>
      7 
      8 <body>
      9 <script>
     10 'use strict';
     11 
     12 promise_test(async () => {
     13  const ancestor_key = token();
     14  let url0 = generateURL("/shared-storage/resources/frame0.html",
     15                         [ancestor_key]);
     16  let url1 = generateURL("/shared-storage/resources/frame1.html",
     17                         [ancestor_key]);
     18 
     19  await addModuleOnce("/shared-storage/resources/simple-module.js");
     20 
     21  let select_url_result0 = await sharedStorage.selectURL(
     22      "increment-global-variable-and-return-original-value-operation",
     23      [{url: url0}, {url: url1}], {resolveToConfig: true, keepAlive: true});
     24  assert_true(validateSelectURLResult(select_url_result0, true));
     25  attachFencedFrame(select_url_result0, 'opaque-ads');
     26  const result0 = await nextValueFromServer(ancestor_key);
     27  assert_equals(result0, "frame0_loaded");
     28 
     29  let select_url_result1 = await sharedStorage.worklet.selectURL(
     30      "increment-global-variable-and-return-original-value-operation",
     31      [{url: url0}, {url: url1}], {resolveToConfig: true, keepAlive: true});
     32  assert_true(validateSelectURLResult(select_url_result1, true));
     33  attachFencedFrame(select_url_result1, 'opaque-ads');
     34  const result1 = await nextValueFromServer(ancestor_key);
     35 
     36  // This indicates that the prior sharedStorage.selectURL() and
     37  // sharedStorage.worklet.selectURL() ran in the same worklet environment.
     38  assert_equals(result1, "frame1_loaded");
     39 
     40 }, 'selectURL() on window.sharedStorage and window.sharedStorage.worklet ' +
     41   'successively. The two calls should run in the same worklet environment.');
     42 
     43 </script>
     44 </body>