Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / canvas / test / test_offscreencanvas_subworker.html
blobbc33d339c881664620c04fca09791042bcdab7ca
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>OffscreenCanvas: Test subworkers</title>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
7 </head>
8 <body>
9 <!--
10 We want to test offscreen canvas works well when it running on worker
11 and nested worker simultaneously. So we create 10 canvas and dispatch
12 it to different workers and sub-workers.
13 -->
14 <script>
16 SimpleTest.waitForExplicitFinish();
18 function createCanvas() {
19 var htmlCanvas = document.createElement('canvas');
20 htmlCanvas.width = 64;
21 htmlCanvas.height = 64;
22 document.body.appendChild(htmlCanvas);
23 return htmlCanvas.transferControlToOffscreen();
26 function runTest() {
28 var worker = new Worker("offscreencanvas.js");
30 worker.onmessage = function(evt) {
31 var msg = evt.data || {};
32 if (msg.type == "test") {
33 ok(msg.result, msg.name);
35 if (msg.type == "finish") {
36 worker.terminate();
37 SimpleTest.finish();
41 var findTransferables = function(t) {
42 if (t.test == "subworker") {
43 var result = [];
44 t.subtests.forEach(function(test) {
45 result = result.concat(findTransferables(test));
46 });
48 return result;
49 } else {
50 return [t.canvas];
54 var testData =
55 {test: 'subworker', subtests: [
56 {test: 'webgl', canvas: createCanvas()},
57 {test: 'subworker', subtests: [
58 {test: 'webgl', canvas: createCanvas()},
59 {test: 'webgl_changesize', canvas: createCanvas()},
60 {test: 'webgl', canvas: createCanvas()}
61 ]},
62 {test: 'subworker', subtests: [
63 {test: 'webgl', canvas: createCanvas()},
64 {test: 'webgl_changesize', canvas: createCanvas()},
65 {test: 'subworker', subtests: [
66 {test: 'webgl_changesize', canvas: createCanvas()},
67 {test: 'webgl', canvas: createCanvas()}
68 ]},
69 {test: 'subworker', subtests: [
70 {test: 'webgl_changesize', canvas: createCanvas()},
71 {test: 'subworker', subtests: [
72 {test: 'subworker', subtests: [
73 {test: 'webgl_changesize', canvas: createCanvas()}
76 ]},
78 ]};
80 worker.postMessage(testData, findTransferables(testData));
83 SpecialPowers.pushPrefEnv({'set': [
84 ['webgl.force-enabled', true],
85 ]}, runTest);
87 </script>
88 </body>
89 </html>