Bug 1322746 - dom/base/test/test_anonymousContent_canvas.html should not assume webgl works. - r=daoshengmu draft
authorjgilbert@mozilla.com <jgilbert@mozilla.com>
Wed, 23 Aug 2017 08:08:58 +0000
changeset 655214 3b44caaf117a567d2d55f3d6709685a7448ea255
parent 655213 23aab5b7255005525b156e265fa4c162f24a331e
child 728765 f814723edb1b1dfbd8bd91c7bc560191a10ed4e7
push id76798
push userbmo:dmu@mozilla.com
push dateTue, 29 Aug 2017 18:29:40 +0000
reviewersdaoshengmu
bugs1322746
milestone57.0a1
Bug 1322746 - dom/base/test/test_anonymousContent_canvas.html should not assume webgl works. - r=daoshengmu MozReview-Commit-ID: 60PrRqA7Nth
dom/base/test/test_anonymousContent_canvas.html
--- a/dom/base/test/test_anonymousContent_canvas.html
+++ b/dom/base/test/test_anonymousContent_canvas.html
@@ -38,20 +38,22 @@ https://bugzilla.mozilla.org/show_bug.cg
         "Context is null for unknown context type");
 
     SimpleTest.doesThrow(
       () => anonymousContent.getCanvasContext("foo", "2d"),
       "NS_ERROR_NOT_AVAILABLE",
       "Get a context using unexisting id should throw"
     );
 
-    let webgl = anonymousContent.getCanvasContext("canvas-webgl", "webgl");
+    const normalWebGL = document.createElement('canvas').getContext('webgl');
+    if (normalWebGL) {
+      let webgl = anonymousContent.getCanvasContext("canvas-webgl", "webgl");
 
-    is(webgl.toString(), "[object WebGLRenderingContext]",
-        "WebGL Context is returned properly");
+      is(webgl.toString(), "[object WebGLRenderingContext]",
+          "WebGL Context is returned properly");
 
-    is(webgl.canvas, null,
-        "WebGL context's canvas property is null in anonymous content");
-
+      is(webgl.canvas, null,
+          "WebGL context's canvas property is null in anonymous content");
+    }
     chromeDocument.removeAnonymousContent(anonymousContent);
   </script>
 </body>
 </html>