tor-browser

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

base-url-detached-document-blank.https.window.js (836B)


      1 // Verify that an about:blank document remembers the baseURI
      2 // it was created with even after it's detached.
      3 const runTest = () => {
      4  async_test((t) => {
      5    const frame = document.createElement('iframe');
      6    frame.src = "about:blank";
      7 
      8    frame.onload = () => {
      9      const frame_doc = frame.contentDocument;
     10      const initial_base_uri = document.baseURI;
     11      assert_equals(initial_base_uri, frame_doc.baseURI);
     12 
     13      const base_element = document.createElement('base');
     14      base_element.href = "https://example.com";
     15      document.head.appendChild(base_element);
     16      assert_equals(initial_base_uri, frame_doc.baseURI);
     17 
     18      frame.remove();
     19      assert_equals(initial_base_uri, frame_doc.baseURI);
     20      t.done();
     21    };
     22 
     23    document.body.appendChild(frame);
     24  }, "about:blank");
     25 };
     26 
     27 onload = () => {
     28  runTest();
     29 };