eventsource_register_worker.html (776B)
1 <!-- 2 Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ 4 --> 5 <!DOCTYPE HTML> 6 <html> 7 <head> 8 <title>Bug 1182103 - Test EventSource scenarios with fetch interception</title> 9 <script type="text/javascript"> 10 11 function getURLParam (aTarget, aValue) { 12 return decodeURI(aTarget.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURI(aValue).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1")); 13 } 14 15 function onLoad() { 16 navigator.serviceWorker.ready.then(function() { 17 parent.postMessage({status: "callback", data: "done"}, "*"); 18 }); 19 20 navigator.serviceWorker.register(getURLParam(document.location, "script"), {scope: "."}); 21 } 22 23 </script> 24 </head> 25 <body onload="onLoad()"> 26 </body> 27 </html>