summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/test_bug1215072.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/canvas/test/test_bug1215072.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/canvas/test/test_bug1215072.html')
-rw-r--r--dom/canvas/test/test_bug1215072.html76
1 files changed, 76 insertions, 0 deletions
diff --git a/dom/canvas/test/test_bug1215072.html b/dom/canvas/test/test_bug1215072.html
new file mode 100644
index 000000000..7e0095ca2
--- /dev/null
+++ b/dom/canvas/test/test_bug1215072.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1215072
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1215072</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 1215072 **/
+ try {
+ var gl = document.createElement("canvas")
+ .getContext("webgl", { get stencil() { throw "bah (webgl)"; } });
+ ok(!gl, "Either should have thrown or not create a webgl context!");
+ } catch(ex) {
+ is(ex, "bah (webgl)", "Should have thrown an exception.");
+ }
+
+ try {
+ var c = document.createElement("canvas")
+ .getContext("2d", { get alpha() {throw "bah (2d)"; } });
+ ok(!c, "Either should have thrown or not create a 2d context!");
+ } catch(ex) {
+ is(ex, "bah (2d)", "Should have thrown an exception.");
+ }
+
+ var gl2;
+ try {
+ gl2 = document.createElement("canvas").getContext("webgl", false);
+ gl2 = document.createElement("canvas").getContext("webgl", 123);
+ gl2 = document.createElement("canvas").getContext("webgl", "");
+ gl2 = document.createElement("canvas").getContext("webgl", undefined);
+ gl2 = document.createElement("canvas").getContext("webgl", null);
+ ok(true, "Shouldn't have thrown an exception!");
+ } catch(ex) {
+ ok(false, "Shouldn't have thrown an exception " + ex);
+ }
+
+ var c2;
+ try {
+ c2 = document.createElement("canvas").getContext("2d", false);
+ is(c2.getImageData(1, 1, 1, 1).data[0], 0);
+ is(c2.getImageData(1, 1, 1, 1).data[1], 0);
+ is(c2.getImageData(1, 1, 1, 1).data[2], 0);
+ is(c2.getImageData(1, 1, 1, 1).data[3], 0);
+
+ c2 = document.createElement("canvas").getContext("2d", 123);
+ c2 = document.createElement("canvas").getContext("2d", "");
+ c2 = document.createElement("canvas").getContext("2d", undefined);
+ c2 = document.createElement("canvas").getContext("2d", null);
+ ok(true, "Shouldn't have thrown an exception!");
+
+ c2 = document.createElement("canvas").getContext("2d", { alpha: false });
+ is(c2.getImageData(1, 1, 1, 1).data[0], 0);
+ is(c2.getImageData(1, 1, 1, 1).data[1], 0);
+ is(c2.getImageData(1, 1, 1, 1).data[2], 0);
+ is(c2.getImageData(1, 1, 1, 1).data[3], 255);
+ } catch(ex) {
+ ok(false, "Shouldn't have thrown an exception " + ex);
+ }
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1215072">Mozilla Bug 1215072</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>