Bug 1848619 [wpt PR 41441] - [@scope] Add WPT for name-defining at rules, a=testonly
[gecko.git] / dom / canvas / test / offscreencanvas_serviceworker_inner.html
blobb153f9524a1c1dfcc5d934fe8e80d14f59f4ced7
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>WebGL in OffscreenCanvas</title>
5 </head>
6 <body>
7 <canvas id="c" width="64" height="64"></canvas>
8 <script>
9 function ok(expect, msg) {
10 parent.postMessage({type: "test", result: !!expect, name: msg}, "*");
13 var htmlCanvas = document.getElementById("c");
15 ok(htmlCanvas, "Should have HTML canvas element");
17 var messageChannel = new MessageChannel();
18 messageChannel.port1.onmessage = function(evt) {
19 parent.postMessage(evt.data, "*");
22 ok(htmlCanvas.transferControlToOffscreen, "HTMLCanvasElement has transferControlToOffscreen function");
24 var offscreenCanvas = htmlCanvas.transferControlToOffscreen();
25 ok(offscreenCanvas, "Expected transferControlToOffscreen to succeed");
27 navigator.serviceWorker.ready.then(function() {
28 navigator.serviceWorker.controller.postMessage({test: 'webgl', canvas: offscreenCanvas}, [offscreenCanvas, messageChannel.port2]);
29 });
30 </script>
31 </body>
32 </html>