test_navigate_after_pagehide.html (872B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>Test for navigation attempts by scripts in inactive inner window</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 </head> 8 <body> 9 <iframe src="dummy_page.html" id="iframe"></iframe> 10 11 <script> 12 "use strict"; 13 14 add_task(async function() { 15 let iframe = document.getElementById("iframe"); 16 17 let navigate = iframe.contentWindow.eval(`(function() { 18 location.href = "/"; 19 })`); 20 21 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 22 iframe.src = "http://example.com/"; 23 await new Promise(resolve => 24 iframe.addEventListener("load", resolve, { once: true }) 25 ); 26 27 // This should do nothing. But, importantly, it should especially not crash. 28 navigate(); 29 30 ok(true, "We didn't crash"); 31 }); 32 </script> 33 </body> 34 </html>