Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / canvas / test / test_bug1215072.html
blob7db00d53fef5d0aca0e609b6c179259289706a5f
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1215072
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 1215072</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <script type="application/javascript">
13 /** Test for Bug 1215072 **/
14 try {
15 var gl = document.createElement("canvas")
16 .getContext("webgl", { get stencil() { throw "bah (webgl)"; } });
17 ok(!gl, "Either should have thrown or not create a webgl context!");
18 } catch(ex) {
19 is(ex, "bah (webgl)", "Should have thrown an exception.");
22 try {
23 var c = document.createElement("canvas")
24 .getContext("2d", { get alpha() {throw "bah (2d)"; } });
25 ok(!c, "Either should have thrown or not create a 2d context!");
26 } catch(ex) {
27 is(ex, "bah (2d)", "Should have thrown an exception.");
30 var gl2;
31 try {
32 gl2 = document.createElement("canvas").getContext("webgl", false);
33 gl2 = document.createElement("canvas").getContext("webgl", 123);
34 gl2 = document.createElement("canvas").getContext("webgl", "");
35 gl2 = document.createElement("canvas").getContext("webgl", undefined);
36 gl2 = document.createElement("canvas").getContext("webgl", null);
37 ok(true, "Shouldn't have thrown an exception!");
38 } catch(ex) {
39 ok(false, "Shouldn't have thrown an exception " + ex);
42 var c2;
43 try {
44 c2 = document.createElement("canvas").getContext("2d", false);
45 is(c2.getImageData(1, 1, 1, 1).data[0], 0);
46 is(c2.getImageData(1, 1, 1, 1).data[1], 0);
47 is(c2.getImageData(1, 1, 1, 1).data[2], 0);
48 is(c2.getImageData(1, 1, 1, 1).data[3], 0);
50 c2 = document.createElement("canvas").getContext("2d", 123);
51 c2 = document.createElement("canvas").getContext("2d", "");
52 c2 = document.createElement("canvas").getContext("2d", undefined);
53 c2 = document.createElement("canvas").getContext("2d", null);
54 ok(true, "Shouldn't have thrown an exception!");
56 c2 = document.createElement("canvas").getContext("2d", { alpha: false });
57 is(c2.getImageData(1, 1, 1, 1).data[0], 0);
58 is(c2.getImageData(1, 1, 1, 1).data[1], 0);
59 is(c2.getImageData(1, 1, 1, 1).data[2], 0);
60 is(c2.getImageData(1, 1, 1, 1).data[3], 255);
61 } catch(ex) {
62 ok(false, "Shouldn't have thrown an exception " + ex);
65 </script>
66 </head>
67 <body>
68 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1215072">Mozilla Bug 1215072</a>
69 <p id="display"></p>
70 <div id="content" style="display: none">
72 </div>
73 <pre id="test">
74 </pre>
75 </body>
76 </html>