tor-browser

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

create-in-sandbox-and-adopt-outside-sandbox.https.html (1397B)


      1 <!DOCTYPE html>
      2 <title>Test fenced frame sandbox adoption</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="resources/utils.js"></script>
      6 <script src="/common/utils.js"></script>
      7 
      8 <body>
      9 <script>
     10 promise_test(async() => {
     11  const fenced_frame_loaded_key = token();
     12 
     13  const iframe = document.createElement('iframe');
     14  iframe.setAttribute('sandbox', 'allow-same-origin');
     15  document.body.append(iframe);
     16 
     17  const inner_document = iframe.contentDocument;
     18  const fenced_frame = inner_document.createElement('fencedframe');
     19  // The `inner_document` is not suitable to host a fenced frame because its
     20  // sandbox flags are too strict.
     21  inner_document.body.append(fenced_frame);
     22 
     23  // Per https://dom.spec.whatwg.org/#concept-node-append, this will adopt the
     24  // inner fenced frame into the outer (main frame) document.
     25  document.body.append(fenced_frame);
     26  fenced_frame.config =
     27      new FencedFrameConfig(generateURL(
     28          'resources/fenced-frame-loaded.html', [fenced_frame_loaded_key]));
     29  const response = await nextValueFromServer(fenced_frame_loaded_key);
     30  assert_equals(response, "fenced frame loaded",
     31                "The inner frame should be loaded.");
     32 }, "Adopting a fenced frame from a too-strict document to a suitable " +
     33   "document leaves the frame in a functional state");
     34 </script>
     35 </body>