test_offscreencanvas_serviceworker.html (1303B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>WebGL in OffscreenCanvas</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" href="/tests/SimpleTest/test.css"> 7 </head> 8 <body> 9 <script> 10 11 SimpleTest.waitForExplicitFinish(); 12 13 function runTest() { 14 var registration; 15 16 window.onmessage = function(evt) { 17 var msg = evt.data || {}; 18 if (msg.type == "test") { 19 ok(msg.result, msg.name); 20 } 21 if (msg.type == "finish") { 22 registration.unregister().then(function() { 23 SimpleTest.finish(); 24 }); 25 } 26 } 27 28 navigator.serviceWorker.register('offscreencanvas.js', { scope: "."}) 29 // Wait until the service worker is active. 30 .then(function(swr) { 31 registration = swr; 32 return navigator.serviceWorker.ready; 33 }) 34 // ...and then show the interface for the commands once it's ready. 35 .then(function() { 36 iframe = document.createElement("iframe"); 37 iframe.setAttribute('src', "offscreencanvas_serviceworker_inner.html"); 38 document.body.appendChild(iframe); 39 }) 40 } 41 42 SpecialPowers.pushPrefEnv({'set': [ 43 ['webgl.force-enabled', true], 44 ["dom.serviceWorkers.exemptFromPerDomainMax", true], 45 ["dom.serviceWorkers.enabled", true], 46 ["dom.serviceWorkers.testing.enabled", true] 47 ]}, runTest); 48 49 </script> 50 </body> 51 </html>