Bug 1296059 - Fix test harness to force-enable webgl2. CLOSED TREE
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 19 Aug 2016 16:21:15 -0700
changeset 349820 9aea5a70f2679e59ad80a66785215a10c7073928
parent 349819 e60871a5840385e6f0b920da333b18e7004f96f4
child 349821 71313593e2458fe97824d2419c17f8ec7766e7fb
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1296059
milestone50.0a2
Bug 1296059 - Fix test harness to force-enable webgl2. CLOSED TREE MozReview-Commit-ID: Lq1Je5HrxFL
dom/canvas/test/webgl-conf/mochi-single.html
--- a/dom/canvas/test/webgl-conf/mochi-single.html
+++ b/dom/canvas/test/webgl-conf/mochi-single.html
@@ -29,37 +29,45 @@ window.webglTestHarness = {
     if (parent) {
       parent.SimpleTest.finish();
     } else {
       console.log('SimpleTest.finish()');
     }
   },
 };
 
-if (parent) {
-  parent.SimpleTest.waitForExplicitFinish();
-  parent.SimpleTest.requestFlakyTimeout('untriaged');
+if ('SpecialPowers' in window) {
+  if (parent) {
+    parent.SimpleTest.waitForExplicitFinish();
+    parent.SimpleTest.requestFlakyTimeout('untriaged');
 
-  try {
     if (navigator.appVersion.indexOf('Android') != -1) {
       // From layout/tools/reftest/reftest.js:
       var version = SpecialPowers.Services.sysinfo.getProperty('version');
       var kAndroidVersion2_3 = 9;
       if (version == kAndroidVersion2_3) {
         var timeoutLengthMultiplier = 2.0;
         parent.SimpleTest.requestLongerTimeout(timeoutLengthMultiplier);
       }
     }
-  } catch (e) {
-    console.log('Warning: No SpecialPowers.');
   }
+
+  var setPrefList = [
+    ['webgl.force-enabled', true],
+    ['webgl.enable-webgl2', true],
+  ];
+  SpecialPowers.pushPrefEnv({'set': setPrefList}, begin);
+} else {
+  console.log('Warning: No SpecialPowers.');
+  begin();
 }
 
-SpecialPowers.pushPrefEnv({"set": [['webgl.force-enabled', true]]});
 ////////////////////////////////////////////////////////////////////////
 
-var testPath = location.search.substr(1);
-console.log('testPath: ' + testPath);
-frameElem.src = testPath;
+function begin() {
+  var testPath = location.search.substr(1);
+  console.log('testPath: ' + testPath);
+  frameElem.src = testPath;
+}
 
 </script>
 </body>
 </html>