tor-browser

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

blob-module-script-url.tentative.https.sub.html (1532B)


      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  let module_content = `
     14    class TestURLSelectionOperation {
     15      async run(urls, data) {
     16        if (data && data.hasOwnProperty('mockResult')) {
     17          return data['mockResult'];
     18        }
     19 
     20        return -1;
     21      }
     22    }
     23 
     24    register('test-url-selection-operation', TestURLSelectionOperation);
     25  `
     26 
     27  let blob = new Blob([module_content], {type: 'text/javascript'});
     28 
     29  await sharedStorage.worklet.addModule(URL.createObjectURL(blob));
     30 
     31  const ancestor_key = token();
     32  let url0 = generateURL("/shared-storage/resources/frame0.html",
     33                         [ancestor_key]);
     34  let url1 = generateURL("/shared-storage/resources/frame1.html",
     35                         [ancestor_key]);
     36 
     37  let select_url_result1 = await sharedStorage.selectURL(
     38    "test-url-selection-operation", [{url: url0}, {url: url1}],
     39    {data: {'mockResult': 1}, resolveToConfig: true,
     40     keepAlive: true});
     41  assert_true(validateSelectURLResult(select_url_result1, /*resolve_to_config=*/true));
     42  attachFencedFrame(select_url_result1, 'opaque-ads');
     43  const result1 = await nextValueFromServer(ancestor_key);
     44  assert_equals(result1, "frame1_loaded");
     45 }, 'addModule() with a Blob URL');
     46 
     47 </script>
     48 </body>