4 https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
8 <title>Test for Bug
1107592</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">
12 /* global TestInterfaceJS */
13 /** Test for Bug
1107592 **/
15 SimpleTest.waitForExplicitFinish();
18 var file = location.href;
21 /* Async parent frames from pushPrefEnv don't show up in e10s. */
22 if (!SpecialPowers.getBoolPref(
"javascript.options.asyncstack_capture_debuggee_only")) {
23 asyncFrame = `Async*@${file}:
153:
17
29 var t = new TestInterfaceJS();
33 ok(e instanceof Error,
"Should have an Error here");
34 ok(!(e instanceof DOMException),
"Should not have DOMException here");
35 ok(!(
"code" in e),
"Should not have a 'code' property");
36 is(e.name,
"Error",
"Should not have an interesting name here");
37 is(e.message,
"We are an Error",
"Should have the right message");
41 "Exception stack should still only show our code");
44 "Should have the right file name");
45 is(e.lineNumber,
31,
"Should have the right line number");
46 is(e.columnNumber,
9,
"Should have the right column number");
50 t.testThrowDOMException();
52 ok(e instanceof Error,
"Should also have an Error here");
53 ok(e instanceof DOMException,
"Should have DOMException here");
54 is(e.name,
"NotSupportedError",
"Should have the right name here");
55 is(e.message,
"We are a DOMException",
56 "Should also have the right message");
57 is(e.code, DOMException.NOT_SUPPORTED_ERR,
58 "Should have the right 'code'");
62 "Exception stack should still only show our code");
65 "Should still have the right file name");
66 is(e.lineNumber,
50,
"Should still have the right line number");
67 todo_isnot(e.columnNumber,
0,
68 "No column number support for DOMException yet");
72 t.testThrowTypeError();
74 ok(e instanceof TypeError,
"Should have a TypeError here");
75 ok(!(e instanceof DOMException),
"Should not have DOMException here (2)");
76 ok(!(
"code" in e),
"Should not have a 'code' property (2)");
77 is(e.name,
"TypeError",
"Should be named TypeError");
78 is(e.message,
"We are a TypeError",
79 "Should also have the right message (2)");
83 "Exception stack for TypeError should only show our code");
86 "Should still have the right file name for TypeError");
87 is(e.lineNumber,
72,
"Should still have the right line number for TypeError");
88 is(e.columnNumber,
9,
"Should have the right column number for TypeError");
92 t.testThrowCallbackError(function() { Array.prototype.forEach(); });
94 ok(e instanceof TypeError,
"Should have a TypeError here (3)");
95 ok(!(e instanceof DOMException),
"Should not have DOMException here (3)");
96 ok(!(
"code" in e),
"Should not have a 'code' property (3)");
97 is(e.name,
"TypeError",
"Should be named TypeError (3)");
98 is(e.message,
"missing argument 0 when calling function Array.prototype.forEach",
99 "Should also have the right message (3)");
101 `doTest/<@${file}:
92:
61
104 "Exception stack for TypeError should only show our code (3)");
107 "Should still have the right file name for TypeError (3)");
108 is(e.lineNumber,
92,
"Should still have the right line number for TypeError (3)");
109 is(e.columnNumber,
61,
"Should have the right column number for TypeError (3)");
113 t.testThrowXraySelfHosted();
115 ok(!(e instanceof Error),
"Should have an Exception here (4)");
116 ok(!(e instanceof DOMException),
"Should not have DOMException here (4)");
117 ok(!(
"code" in e),
"Should not have a 'code' property (4)");
118 is(e.name,
"NS_ERROR_UNEXPECTED",
"Name should be sanitized (4)");
119 is(e.message,
"",
"Message should be sanitized (5)");
121 `doTest@${file}:
113:
9
123 "Exception stack for sanitized exception should only show our code (4)");
126 "Should still have the right file name for sanitized exception (4)");
127 is(e.lineNumber,
113,
"Should still have the right line number for sanitized exception (4)");
128 todo_isnot(e.columnNumber,
0,
"Should have the right column number for sanitized exception (4)");
132 t.testThrowSelfHosted();
134 ok(!(e instanceof Error),
"Should have an Exception here (5)");
135 ok(!(e instanceof DOMException),
"Should not have DOMException here (5)");
136 ok(!(
"code" in e),
"Should not have a 'code' property (5)");
137 is(e.name,
"NS_ERROR_UNEXPECTED",
"Name should be sanitized (5)");
138 is(e.message,
"",
"Message should be sanitized (5)");
140 `doTest@${file}:
132:
9
142 "Exception stack for sanitized exception should only show our code (5)");
145 "Should still have the right file name for sanitized exception (5)");
146 is(e.lineNumber,
132,
"Should still have the right line number for sanitized exception (5)");
147 todo_isnot(e.columnNumber,
0,
"Should have the right column number for sanitized exception (5)");
153 SpecialPowers.pushPrefEnv({set: [[
"dom.expose_test_interfaces", true]]},
158 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1107592">Mozilla Bug
1107592</a>
160 <div id=
"content" style=
"display: none">