Bug 1322746 - dom/base/test/test_anonymousContent_canvas.html should not assume webgl works. - r=daoshengmu
MozReview-Commit-ID: 7oEK4pWMCdc
--- 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>