fs-noop.sub.html (823B)
1 <!doctype html> 2 <html> 3 <title>No-op window</title> 4 <head> 5 <script src="/resources/testharness.js"></script> 6 </head> 7 <body> 8 <div id="log"></div> 9 <script> 10 window.addEventListener("load", () => { 11 const params = new URLSearchParams(window.location.search); 12 const channelName = params.get("channel"); 13 if (!channelName) { 14 // On irrecoverable errors, window is closed: parent should check this. 15 window.close(); 16 17 throw new Error("Unknown channel name"); 18 } 19 20 const channel = new BroadcastChannel(channelName); 21 22 channel.onmessage = async ev => { 23 if (ev.data == "cleanup") { 24 channel.postMessage("done"); 25 } 26 }; 27 28 channel.postMessage("200 OK"); 29 }); 30 </script> 31 </body> 32 </html>