SharedArrayBuffer plus WebGL should not equal CRASH
[WebKit-https.git] / LayoutTests / js / shared-array-buffer-webgl.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <canvas id="canvas"></canvas>
8 <script>
9 description('Test that passing a SharedArrayBuffer to WebGL does not crash.')
10
11 var canvas = document.getElementById("canvas");
12 var gl = canvas.getContext("webgl");
13 var texture = gl.createTexture();
14
15 var ext = (
16   gl.getExtension("WEBGL_compressed_texture_s3tc") ||
17   gl.getExtension("MOZ_WEBGL_compressed_texture_s3tc") ||
18   gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc")
19 );
20
21 var data = new SharedArrayBuffer(1024);
22 var view = new Uint8Array(data);
23
24 try {
25     var texture = gl.createTexture();
26     gl.bindTexture(gl.TEXTURE_2D, texture);
27     gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ext.COMPRESSED_RGBA_S3TC_DXT5_EXT, 512, 512, 0, view);
28 } catch (e) { } // This shouldn't crash.
29 </script>
30 <script src="../resources/js-test-post.js"></script>
31 </body>
32 </html>