3 function EnsureExt(extName, shouldHave = true) {
4 EnsureExtFor("webgl", extName, shouldHave);
5 EnsureExtFor("webgl2", extName, shouldHave);
8 function EnsureExtFor(contextType, extName, shouldHave = true) {
9 var c = document.createElement("canvas");
10 var gl = c.getContext(contextType);
13 todo(false, "Failed to create context: " + contextType);
17 var ext = gl.getExtension(extName);
18 var haveText = " have " + contextType + " extension " + extName + ".";
20 ok(ext, "Should" + haveText);
22 ok(!ext, "Should not" + haveText);
26 function Lastly_WithDraftExtsEnabled(func) {
27 SimpleTest.waitForExplicitFinish();
29 var fnEnsure = function () {
34 if ("SpecialPowers" in window) {
35 var prefStateList = [["webgl.enable-draft-extensions", true]];
36 var prefEnv = { set: prefStateList };
37 SpecialPowers.pushPrefEnv(prefEnv, fnEnsure);
39 console.log("Couldn't use SpecialPowers to enable draft extensions.");