location-set-and-document-open.html (995B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title></title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <body> 7 <script> 8 var t = async_test("Location sets should cancel current navigation and prevent later document.open() from doing anything"); 9 10 var finishTest = t.step_func_done(function() { 11 assert_equals(frames[0].document.body.textContent, "PASS", 12 "Should not have FAIL in our textContent"); 13 }); 14 15 t.step(function() { 16 var i = document.createElement("iframe"); 17 i.srcdoc = ` 18 <script> 19 var blob = new Blob(["PASS"], { type: "text/html" }); 20 var url = URL.createObjectURL(blob); 21 location.href = url; 22 frameElement.onload = parent.finishTest; 23 document.open(); 24 document.write("FAIL"); 25 document.close(); 26 <\/script>`; 27 document.body.appendChild(i); 28 }); 29 30 </script> 31 </body>