module-static-import.html (862B)
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 10 iframe.onerror = t.unreached_func("Error loading iframe"); 11 12 let testEndWasCalled = false; 13 document.addEventListener("documentWriteDone", t.step_func(() => { 14 testEndWasCalled = true; 15 assert_equals(iframe.contentDocument.body.textContent, "Initial body contents\n"); 16 })); 17 iframe.onload = t.step_func_done(() => { 18 assert_true(testEndWasCalled, "onload must be called"); 19 assert_equals(iframe.contentDocument.body.textContent, "Initial body contents\n"); 20 }); 21 22 iframe.src = "module-static-import-iframe.html"; 23 document.body.appendChild(iframe); 24 }); 25 </script> 26 ß