tor-browser

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

module-tla-import.html (957B)


      1 <!doctype html>
      2 <title>document.write in an imported module</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id="log"></div>
      6 <script>
      7 async_test(t => {
      8  const iframe = document.createElement("iframe");
      9  iframe.onerror = t.unreached_func("Error loading iframe");
     10 
     11  let onLoadWasCalled = false;
     12 
     13  iframe.onload = t.step_func(() => {
     14    onLoadWasCalled = true;
     15    assert_equals(iframe.contentDocument.body.textContent, "Initial body contents\n");
     16    // Don't call the event handler another time after document.write.
     17    iframe.onload = null;
     18  });
     19  document.addEventListener("documentWriteDone", t.step_func_done(() => {
     20    assert_true(onLoadWasCalled, "onload must be called");
     21    assert_equals(iframe.contentDocument.body.textContent, "document.write body contents\n");
     22  }));
     23 
     24  iframe.src = "module-tla-import-iframe.html";
     25  document.body.appendChild(iframe);
     26 });
     27 </script>