Bug 1245875 - Add missing createCanvas function in webgl-utils to fix mochitest-dt5 failures. r=me
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 03 Mar 2016 07:55:36 -0800
changeset 322924 d3bd4762581e1bf0dae4c17acd1a7ff65dccc299
parent 322923 c98d9f463bf75f2348c1e6fe53849fab19f8fc46
child 322925 0e4a7aef432e7dab0133cdf28daa1fb71ada2733
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1245875
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1245875 - Add missing createCanvas function in webgl-utils to fix mochitest-dt5 failures. r=me
devtools/client/canvasdebugger/test/head.js
devtools/client/shadereditor/test/head.js
devtools/client/shared/webgl-utils.js
--- a/devtools/client/canvasdebugger/test/head.js
+++ b/devtools/client/canvasdebugger/test/head.js
@@ -135,17 +135,17 @@ function createCanvas() {
 }
 
 function isTestingSupported() {
   if (!gRequiresWebGL) {
     info("This test does not require WebGL support.");
     return true;
   }
 
-  let supported = isWebGLSupported();
+  let supported = isWebGLSupported(document);
 
   info("This test requires WebGL support.");
   info("Apparently, WebGL is" + (supported ? "" : " not") + " supported.");
   return supported;
 }
 
 function once(aTarget, aEventName, aUseCapture = false) {
   info("Waiting for event: '" + aEventName + "' on " + aTarget + ".");
--- a/devtools/client/shadereditor/test/head.js
+++ b/devtools/client/shadereditor/test/head.js
@@ -113,17 +113,17 @@ function ifWebGLSupported() {
 }
 
 function ifWebGLUnsupported() {
   todo(false, "Skipping test because WebGL isn't supported.");
   finish();
 }
 
 function test() {
-  let generator = isWebGLSupported() ? ifWebGLSupported : ifWebGLUnsupported;
+  let generator = isWebGLSupported(document) ? ifWebGLSupported : ifWebGLUnsupported;
   Task.spawn(generator).then(null, handleError);
 }
 
 function createCanvas() {
   return document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
 }
 
 function once(aTarget, aEventName, aUseCapture = false) {
--- a/devtools/client/shared/webgl-utils.js
+++ b/devtools/client/shared/webgl-utils.js
@@ -38,17 +38,21 @@ function create3DContext(aCanvas)
   try {
     context = aCanvas.getContext(WEBGL_CONTEXT_NAME, aFlags);
   } catch(e) {
     return null;
   }
   return context;
 }
 
-function isWebGLSupported() {
+function createCanvas(doc) {
+  return doc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
+}
+
+function isWebGLSupported(doc) {
   let supported =
     !isWebGLForceEnabled() &&
      isWebGLSupportedByGFX() &&
-     create3DContext(createCanvas());
+     create3DContext(createCanvas(doc));
 
   return supported;
 }
 exports.isWebGLSupported = isWebGLSupported;