4 <title>WebGL in OffscreenCanvas
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
9 <canvas id=
"c" width=
"64" height=
"64"></canvas>
12 SimpleTest
.waitForExplicitFinish();
16 var htmlCanvas
= document
.getElementById("c");
17 var worker
= new SharedWorker("offscreencanvas.js");
19 ok(htmlCanvas
, "Should have HTML canvas element");
20 ok(worker
, "Web worker successfully created");
22 ok(htmlCanvas
.transferControlToOffscreen
, "HTMLCanvasElement has transferControlToOffscreen function");
24 var offscreenCanvas
= htmlCanvas
.transferControlToOffscreen();
25 ok(offscreenCanvas
, "Expected transferControlToOffscreen to succeed");
29 // We don't support transferring OffscreenCanvas via shared worker.
32 worker
.port
.postMessage({test
: 'webgl', canvas
: offscreenCanvas
}, [offscreenCanvas
]);
34 "OffscreenCanvas cannot transfer to shared worker"
40 SpecialPowers
.pushPrefEnv({'set': [
41 ['webgl.force-enabled', true],