test_web_controlled_blank.html (1501B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>Bug 1813463: Web controlled about:blank</title> 5 </head> 6 <!-- 7 This work is marked with CC0 1.0. To view a copy of this license, 8 visit http://creativecommons.org/publicdomain/zero/1.0 9 --> 10 <body> 11 <p><a href="#" id="document_write">document.write example</a></p> 12 <p><a href="#" id="innerhtml">innerHTML example</a></p> 13 14 <script> 15 document.getElementById("document_write").addEventListener("click", function (aEvent) { 16 aEvent.preventDefault(); 17 let popup = window.open("about:blank", "_blank", "width=800,height=600,popup"); 18 popup.document.write(` 19 <h1>check security info</h1> 20 <p>initial window.location = ${popup.location}</p> 21 <script> 22 document.write("<p>new window.location = " + window.location + "</p>") 23 <${"/"}script> 24 `); 25 }); 26 document.getElementById("innerhtml").addEventListener("click", function (aEvent) { 27 aEvent.preventDefault(); 28 let popup = window.open("about:blank", "_blank", "width=800,height=600,popup"); 29 popup.stop(); 30 popup.document.body.innerHTML = ` 31 <h1>check security info</h1> 32 <p>window.location = ${popup.location}</p>`; 33 }); 34 </script> 35 </body> 36 </html>