file_child-src_service_worker.html (965B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Bug 1045891</title> 5 </head> 6 <body> 7 <script type="text/javascript"> 8 page_id = window.location.hash.substring(1); 9 try { 10 if ('serviceWorker' in navigator) { 11 navigator.serviceWorker.register( 12 'file_child-src_service_worker.js', 13 { scope: './' + page_id + '/' } 14 ).then(function(reg) 15 { 16 // registration worked 17 reg.unregister().then(function() { 18 window.parent.postMessage({id:page_id, message:"allowed"}, 'http://mochi.test:8888'); 19 }); 20 }).catch(function(error) { 21 // registration failed 22 window.parent.postMessage({id:page_id, message:"blocked"}, 'http://mochi.test:8888'); 23 }); 24 }; 25 } catch(ex) { 26 window.parent.postMessage({id:page_id, message:"exception"}, 'http://mochi.test:8888'); 27 } 28 </script> 29 </body> 30 </html>