notificationclick.html (722B)
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 1114554 - controlled page</title> 9 <script class="testbody" type="text/javascript"> 10 var testWindow = parent; 11 if (opener) { 12 testWindow = opener; 13 } 14 15 navigator.serviceWorker.ready.then(function(swr) { 16 const args = new URL(location.href).searchParams.get("args"); 17 const argsParsed = JSON.parse(args); 18 swr.showNotification("Hi there. The ServiceWorker should receive a click event for this.", argsParsed); 19 }); 20 21 navigator.serviceWorker.onmessage = function(msg) { 22 testWindow.callback(msg.data); 23 }; 24 </script> 25 26 </head> 27 <body> 28 </body> 29 </html>