2 <title>WebGL test: 'webgl' and 'experimental-webgl' context requests succeed,
3 'moz-webgl' context requests fail.
</title>
4 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
5 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
6 <script src=
"driver-info.js"></script>
8 <canvas id=
"c1"></canvas>
9 <canvas id=
"c2"></canvas>
14 function testContextRetrieval(canvasId
, creationId
, shouldSucceed
) {
15 var canvas
= document
.getElementById(canvasId
);
16 ok(canvas
, 'Invalid `canvasId`: ' + canvasId
);
18 var createdGL
= canvas
.getContext(creationId
);
20 testFunc(createdGL
, 'Request for \'' + creationId
+ '\' should succeed.');
22 ok(!createdGL
, 'Request for \'' + creationId
+ '\' should fail.');
26 SimpleTest
.waitForExplicitFinish();
27 SpecialPowers
.pushPrefEnv({'set': [
28 ['webgl.force-enabled', true]
30 testContextRetrieval('c1', 'experimental-webgl', true);
31 testContextRetrieval('c2', 'moz-webgl', false);