test_webgl2_not_exposed.html (733B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>WebGL test: WebGL2RenderingContext only exposed when appropriate</title> 5 <script src='/tests/SimpleTest/SimpleTest.js'></script> 6 <link rel='stylesheet' href='/tests/SimpleTest/test.css'> 7 </head> 8 <body> 9 <script> 10 11 function ShouldExpose() { 12 try { 13 return SpecialPowers.getBoolPref('webgl.enable-webgl2'); 14 } catch (e) {} 15 16 return false; 17 } 18 19 function DoesExpose() { 20 try { 21 null instanceof WebGL2RenderingContext; 22 return true; 23 } catch (e) {} 24 25 return false; 26 } 27 28 var doesExpose = DoesExpose(); 29 if (ShouldExpose()) { 30 ok(doesExpose, 'WebGL2RenderingContext should be exposed.'); 31 } else { 32 ok(!doesExpose, 'WebGL2RenderingContext should not be exposed.'); 33 } 34 35 </script> 36 </body> 37 </html>