tor-browser

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

remove-from-document.html (968B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>A meta must refresh the original document even if it was removed.</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh">
      7 
      8 <div id="log"></div>
      9 
     10 <script>
     11 "use strict";
     12 setup({ single_test: true });
     13 
     14 const sourceIFrame = document.createElement("iframe");
     15 let sourceLoadCount = 0;
     16 
     17 sourceIFrame.onload = () => {
     18  ++sourceLoadCount;
     19 
     20  if (sourceLoadCount === 2) {
     21    assert_equals(sourceIFrame.contentDocument.body.textContent.trim(), "foo");
     22    done();
     23  }
     24 
     25  maybeStartTest();
     26 };
     27 
     28 function maybeStartTest() {
     29  if (sourceLoadCount === 1) {
     30    sourceIFrame.contentDocument.querySelector("meta").remove();
     31  }
     32 }
     33 
     34 sourceIFrame.src = "support/refresh.sub.html?input=" + encodeURIComponent("1; url=foo");
     35 
     36 document.body.appendChild(sourceIFrame);
     37 </script>