Bug 1322746 - dom/base/test/test_anonymousContent_canvas.html should not assume webgl works. - r=daoshengmu draft
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 23 Aug 2017 01:05:11 -0700
changeset 656971 0aaf80088616ef6133fd5ad2a2052edc8dc68c93
parent 656970 ec715cff1c62838ffc6e67b25c9663eca8131013
child 656972 f8d9f999103d0028f7db2506350977a286d721ef
push id77391
push userbmo:jgilbert@mozilla.com
push dateThu, 31 Aug 2017 22:47:58 +0000
reviewersdaoshengmu
bugs1322746
milestone57.0a1
Bug 1322746 - dom/base/test/test_anonymousContent_canvas.html should not assume webgl works. - r=daoshengmu MozReview-Commit-ID: 7oEK4pWMCdc
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>