Skip to content

Commit 96c41b3

Browse files
Cases from #47: DOMException and strict mode
1 parent 96a50f2 commit 96c41b3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/functional/ExceptionLab.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
document.getElementById("info").innerHTML = text;
1919
}
2020

21+
function detectMode() {
22+
var p = new printStackTrace.implementation(), mode = p.mode(lastException);
23+
info('Stack tracing mode: ' + mode);
24+
}
25+
2126
function dumpStacktrace(guess) {
2227
var trace = printStackTrace({
2328
e: lastException,
@@ -68,6 +73,28 @@
6873
dumpException(ex);
6974
}
7075
}
76+
77+
function dumpDOMException() {
78+
try {
79+
document.body.removeChild(document.createElement('div'));
80+
} catch (ex) {
81+
dumpException(ex);
82+
}
83+
}
84+
85+
function dumpCallChain() {
86+
dumpException({message: 'Error'});
87+
try {
88+
dumpStacktrace();
89+
} catch (ex) {
90+
info('Exception while processing stack trace:\n' + ex);
91+
}
92+
}
93+
94+
function dumpCallChainInStrictMode() {
95+
"use strict";
96+
dumpCallChain();
97+
}
7198
</script>
7299
</head>
73100
<body>
@@ -81,7 +108,13 @@
81108
<button onclick="dumpExceptionAnonymous();" title="Stack with anonymous function">Exception 2</button>
82109
<button onclick="dumpExceptionInEval();" title="Exception in eval()">Exception 3</button>
83110
<button onclick="dumpExceptionMultiLine();" title="Multi-line message in exception">Exception 4</button>
111+
<button onclick="dumpDOMException();" title="DOM exception (without stack in Firefox)">Exception 5</button>
112+
<br />
113+
<button onclick="dumpCallChain();" title="Process call chain">Call chain</button>
114+
<button onclick="dumpCallChainInStrictMode();" title="Process call chain in strict mode">Call chain in strict mode
115+
</button>
84116
<br />
117+
<button onclick="detectMode();">Detect mode</button>
85118
<button onclick="dumpStacktrace();">Process stack trace</button>
86119
<button onclick="dumpStacktrace(true);">Guess anonymous functions</button>
87120
</body>

0 commit comments

Comments
 (0)