service_worker_controlled.html (869B)
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>controlled page</title> 9 <!-- 10 Paged controlled by a service worker for testing matchAll(). 11 See bug 982726, 1058311. 12 --> 13 <script class="testbody" type="text/javascript"> 14 function fail(msg) { 15 info("service_worker_controlled.html: " + msg); 16 opener.postMessage("FAIL", "*"); 17 } 18 19 if (!parent) { 20 info("service_worker_controlled.html should not be launched directly!"); 21 } 22 23 window.onload = function() { 24 navigator.serviceWorker.ready.then(function(swr) { 25 parent.postMessage("READY", "*"); 26 }); 27 } 28 29 navigator.serviceWorker.onmessage = function(msg) { 30 // forward message to the test page. 31 parent.postMessage(msg.data, "*"); 32 }; 33 </script> 34 35 </head> 36 <body> 37 </body> 38 </html>