Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 <!DOCTYPE HTML>
2 <html>
3 <script>
5 // This file has the portion of the test_webgl_renderer_info chrome mochitest
6 // that has to run as non-chrome to check that this WebGL extension is not exposed to content
8 // we can't call the chrome Mochitest ok() function ourselves from non-chrome code.
9 // So we remote it to the chrome test.
11 function ok(res, msg) {
12 // Note we post to ourselves as posting to the chrome code doesn't seem to work here.
13 // This works by having the chrome code put an event handler on our own window.
14 window.postMessage({ subTestFinished: true, result: res, message: msg }, "*");
15 }
17 function messageListener(e) {
18 // This is how the chrome test tells us to start running -- we have to wait for this
19 // message to avoid running before it's set up its event handler.
20 if (e.data == "run") {
21 run();
22 }
23 }
25 window.addEventListener("message", messageListener, true);
27 function run() {
28 const UNMASKED_VENDOR_WEBGL = 0x9245;
29 const UNMASKED_RENDERER_WEBGL = 0x9246;
31 var canvas = document.createElement("canvas");
32 var gl = canvas.getContext("experimental-webgl");
34 ok(!gl.getError(), "getError on newly created WebGL context should return NO_ERROR");
36 ok(!gl.getParameter(UNMASKED_VENDOR_WEBGL) && gl.getError() == gl.INVALID_ENUM,
37 "Should not be able to query UNMASKED_VENDOR_WEBGL without having enabled the WEBGL_debug_renderer_info extension");
38 ok(!gl.getParameter(UNMASKED_RENDERER_WEBGL) && gl.getError() == gl.INVALID_ENUM,
39 "Should not be able to query UNMASKED_RENDERER_WEBGL without having enabled the WEBGL_debug_renderer_info extension");
41 var exts = gl.getSupportedExtensions();
42 ok(exts.indexOf("WEBGL_debug_renderer_info") == -1,
43 "WEBGL_debug_renderer_info should not be listed by getSupportedExtensions in non-chrome contexts");
44 var debugRendererInfoExtension = gl.getExtension("WEBGL_debug_renderer_info");
45 ok(!debugRendererInfoExtension,
46 "WEBGL_debug_renderer_info should not be available through getExtension in non-chrome contexts");
48 ok(!gl.getParameter(UNMASKED_VENDOR_WEBGL) && gl.getError() == gl.INVALID_ENUM,
49 "Should not be able to query UNMASKED_VENDOR_WEBGL if enabling WEBGL_debug_renderer_info failed");
50 ok(!gl.getParameter(UNMASKED_RENDERER_WEBGL) && gl.getError() == gl.INVALID_ENUM,
51 "Should not be able to query UNMASKED_RENDERER_WEBGL if enabling WEBGL_debug_renderer_info failed");
53 window.postMessage({allTestsFinished: true}, "*");
54 }
56 </script>
57 </html>