4 https://bugzilla.mozilla.org/show_bug.cgi?id=1215072
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 **/
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!");
19 is(ex,
"bah (webgl)",
"Should have thrown an exception.");
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!");
27 is(ex,
"bah (2d)",
"Should have thrown an exception.");
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!");
39 ok(false,
"Shouldn't have thrown an exception " + ex);
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);
62 ok(false,
"Shouldn't have thrown an exception " + ex);
68 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1215072">Mozilla Bug
1215072</a>
70 <div id=
"content" style=
"display: none">