@@ -27,8 +27,14 @@ suite('HTMLCanvasElement', function() {
2727 return ;
2828
2929 var canvas = document . createElement ( 'canvas' ) ;
30- var context = canvas . getContext ( 'webgl' ) ;
31- // Chrome returns null if the graphics drivers are not good enough.
30+ var context = null ;
31+ // Firefox throws exception if graphics card is not supported
32+ try {
33+ context = canvas . getContext ( 'webgl' ) ;
34+ }
35+ catch ( ex ) {
36+ }
37+ // Chrome returns null if the graphics card is not supported
3238 assert . isTrue ( context === null || context instanceof WebGLRenderingContext ) ;
3339
3440 if ( context != null )
@@ -60,7 +66,12 @@ suite('HTMLCanvasElement', function() {
6066
6167 test ( 'WebGL texImage2D' , function ( done ) {
6268 var canvas = document . createElement ( 'canvas' ) ;
63- var gl = canvas . getContext ( 'webgl' ) ;
69+ var gl = null ;
70+ // Firefox throws exception if graphics card is not supported
71+ try {
72+ gl = canvas . getContext ( 'webgl' ) ;
73+ } catch ( ex ) {
74+ }
6475 // IE10 does not have WebGL.
6576 // Chrome returns null if the graphics card is not supported
6677 if ( ! gl ) {
@@ -80,7 +91,12 @@ suite('HTMLCanvasElement', function() {
8091
8192 test ( 'WebGL texSubImage2D' , function ( done ) {
8293 var canvas = document . createElement ( 'canvas' ) ;
83- var gl = canvas . getContext ( 'webgl' ) ;
94+ var gl = null ;
95+ // Firefox throws exception if graphics card is not supported
96+ try {
97+ gl = canvas . getContext ( 'webgl' ) ;
98+ } catch ( ex ) {
99+ }
84100 // IE10 does not have WebGL.
85101 // Chrome returns null if the graphics card is not supported
86102 if ( ! gl ) {
0 commit comments