tor-browser

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

bailout-side-effects-synchronous-script.window.js (1199B)


      1 // META: script=resources/document-open-side-effects.js
      2 
      3 async_test(t => {
      4  const iframe = document.body.appendChild(document.createElement("iframe"));
      5  t.add_cleanup(() => iframe.remove());
      6  self.testSynchronousScript = t.step_func(() => {
      7    // Here, the entry settings object is still the iframe's. Delay it in such
      8    // a way that makes the entry settings object the top-level page's, but
      9    // without delaying too much that the parser becomes inactive. A microtask
     10    // is perfect as it's executed in "clean up after running script".
     11    Promise.resolve().then(t.step_func_done(() => {
     12      const origURL = iframe.contentDocument.URL;
     13      assertDocumentIsReadyForSideEffectsTest(iframe.contentDocument, "active parser whose script nesting level is greater than 0");
     14      assert_equals(iframe.contentDocument.open(), iframe.contentDocument);
     15      assertOpenHasNoSideEffects(iframe.contentDocument, origURL, "active parser whose script nesting level is greater than 0");
     16    }));
     17  });
     18  iframe.src = "resources/bailout-order-synchronous-script-frame.html";
     19 }, "document.open bailout should not have any side effects (active parser whose script nesting level is greater than 0)");