tor-browser

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

embedder-context.tentative.https.sub.html (4287B)


      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/resources/util.js"></script>
      7 <script src="/fenced-frame/resources/utils.js"></script>
      8 
      9 <body>
     10 <script>
     11 'use strict';
     12 
     13 promise_test(async () => {
     14  const ancestorKey = token();
     15 
     16  let fencedFrameConfig0 = await runSelectURL(
     17    "/shared-storage/resources/embedder-context-inner.https.html",
     18    [ancestorKey], true);
     19  assert_true(validateSelectURLResult(fencedFrameConfig0, true));
     20 
     21  fencedFrameConfig0.setSharedStorageContext("here is some context");
     22 
     23  attachFencedFrame(fencedFrameConfig0, 'opaque-ads');
     24  const result0 = await nextValueFromServer(ancestorKey);
     25  assert_equals(result0, "embedder_context_inner_loaded");
     26 
     27  let url0 = generateURL("/shared-storage/resources/frame0.html", [ancestorKey]);
     28  let url1 = generateURL("/shared-storage/resources/frame1.html", [ancestorKey]);
     29 
     30  let fencedFrameConfig1 = await sharedStorage.selectURL(
     31    "verify-key-value", [{url: url0}, {url: url1}],
     32    {data: {'expectedKey': ancestorKey,
     33            'expectedValue': 'here is some context'},
     34     resolveToConfig: true,
     35     keepAlive: true});
     36  assert_true(validateSelectURLResult(fencedFrameConfig1, true));
     37 
     38  attachFencedFrame(fencedFrameConfig1, 'opaque-ads');
     39  const result1 = await nextValueFromServer(ancestorKey);
     40  assert_equals(result1, "frame1_loaded");
     41 }, 'embedder sharedStorage.context');
     42 
     43 promise_test(async () => {
     44  const ancestorKey = token();
     45 
     46  let fencedFrameConfig0 = await runSelectURL(
     47    "/shared-storage/resources/embedder-context-inner.https.html",
     48    [ancestorKey], true);
     49  assert_true(validateSelectURLResult(fencedFrameConfig0, true));
     50 
     51  attachFencedFrame(fencedFrameConfig0, 'opaque-ads');
     52  const result0 = await nextValueFromServer(ancestorKey);
     53  assert_equals(result0, "embedder_context_inner_loaded");
     54 
     55  let url0 = generateURL("/shared-storage/resources/frame0.html", [ancestorKey]);
     56  let url1 = generateURL("/shared-storage/resources/frame1.html", [ancestorKey]);
     57 
     58  let fencedFrameConfig1 = await sharedStorage.selectURL(
     59    "verify-key-value", [{url: url0}, {url: url1}],
     60    {data: {'expectedKey': ancestorKey, 'expectedValue': 'undefined'},
     61     resolveToConfig: true,
     62     keepAlive: true});
     63  assert_true(validateSelectURLResult(fencedFrameConfig1, true));
     64 
     65  attachFencedFrame(fencedFrameConfig1, 'opaque-ads');
     66  const result1 = await nextValueFromServer(ancestorKey);
     67  assert_equals(result1, "frame1_loaded");
     68 }, 'undefined embedder sharedStorage.context');
     69 
     70 promise_test(async () => {
     71  const outerKey = token();
     72  const innerKey0 = token();
     73  const innerKey1 = token();
     74 
     75  let fencedFrameConfig0 = await runSelectURL(
     76    "/shared-storage/resources/embedder-context-nested-inner.https.html",
     77    [outerKey, innerKey0, innerKey1], true);
     78  assert_true(validateSelectURLResult(fencedFrameConfig0, true));
     79 
     80  fencedFrameConfig0.setSharedStorageContext("here is some context");
     81 
     82  attachFencedFrame(fencedFrameConfig0, 'opaque-ads');
     83  const result0 = await nextValueFromServer(outerKey);
     84  assert_equals(result0, "embedder_context_nested_inner_loaded");
     85 
     86  let url0 = generateURL("/shared-storage/resources/frame0.html", [outerKey]);
     87  let url1 = generateURL("/shared-storage/resources/frame1.html", [outerKey]);
     88 
     89  let fencedFrameConfig1 = await sharedStorage.selectURL(
     90    "verify-key-value", [{url: url0}, {url: url1}],
     91    {data: {'expectedKey': innerKey0,
     92            'expectedValue': 'here is some context'},
     93     resolveToConfig: true});
     94  assert_true(validateSelectURLResult(fencedFrameConfig1, true));
     95 
     96  attachFencedFrame(fencedFrameConfig1, 'opaque-ads');
     97  const result1 = await nextValueFromServer(outerKey);
     98  assert_equals(result1, "frame1_loaded");
     99 
    100  let iframeURL =
    101    generateURL("/shared-storage/resources/embedder-context-nested-iframe.https.html",
    102                [outerKey, innerKey1]);
    103  iframeURL = getRemoteOriginURL(iframeURL);
    104  attachIFrame(iframeURL);
    105  const result2 = await nextValueFromServer(outerKey);
    106  assert_equals(result2, "embedder_context_nested_iframe_loaded");
    107 }, 'embedder sharedStorage.context with nested iframes');
    108 </script>
    109 </body>