Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / offscreencanvas / offscreencanvas-transfer-image-bitmap.html
blob70b359216b1f31fa216d43a0bd845fc80bfca109
1 <!--
2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
5 -->
6 <!DOCTYPE html>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <title>Test for OffscreenCanvas TransferToImageBitmap</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../js/js-test-pre.js"></script>
13 <script src="../../js/webgl-test-utils.js"></script>
14 <script src="../../js/tests/tex-image-and-sub-image-utils.js"></script>
15 <script src="../../js/tests/offscreencanvas-transfer-image-bitmap.js"></script>
16 </head>
17 <body>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id='myWorker' type='text/worker'>
21 self.onmessage = function(e) {
22 var canvas = new OffscreenCanvas(128, 128);
23 var gl = canvas.getContext("webgl");
24 gl.clearColor(1.0, 1.0, 0.0, 1.0);
25 gl.clear(gl.COLOR_BUFFER_BIT);
26 var image = canvas.transferToImageBitmap();
28 self.postMessage({ bitmap: image },
29 [ image ]);
31 </script>
32 <script>
33 "use strict";
34 description("This test ensures that the transferToImageBitmap function of OffscreenCanvas webgl context is functional.");
35 if (!window.OffscreenCanvas) {
36 testPassed("No OffscreenCanvas support");
37 finishTest();
38 } else {
39 var blob = new Blob([document.getElementById('myWorker').textContent]);
40 var worker = new Worker(URL.createObjectURL(blob));
42 worker.onmessage = function(msg) {
43 testTransferToImageBitmap("webgl", msg.data.bitmap);
44 finishTest();
46 worker.postMessage("Start Worker");
48 </script>
49 </body>
50 </html>