summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/examples/exceptions.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/test/mochitest/examples/exceptions.js')
-rw-r--r--devtools/client/debugger/test/mochitest/examples/exceptions.js88
1 files changed, 88 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/examples/exceptions.js b/devtools/client/debugger/test/mochitest/examples/exceptions.js
new file mode 100644
index 0000000000..9901fe9775
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/examples/exceptions.js
@@ -0,0 +1,88 @@
+function uncaughtException() {
+ throw "unreachable"
+}
+
+function caughtException() {
+ try {
+ throw "reachable";
+ } catch (e) {
+ debugger;
+ }
+}
+
+function deepError() {
+ function a() { b(); }
+ function b() { c(); }
+ function c() { throw new Error(); }
+
+ try {
+ a();
+ } catch (e) {}
+
+ debugger;
+}
+
+function deepErrorFinally() {
+ function a() { b(); }
+ function b() {
+ try {
+ c();
+ } finally {
+ debugger;
+ }
+ }
+ function c() { throw new Error(); }
+
+ try {
+ a();
+ } catch (e) {}
+
+ debugger;
+}
+
+function deepErrorCatch() {
+ function a() { b(); }
+ function b() {
+ try {
+ c();
+ } catch (e) {
+ debugger;
+ throw e;
+ }
+ }
+ function c() { throw new Error(); }
+
+ try {
+ a();
+ } catch (e) {}
+
+ debugger;
+}
+
+function deepErrorThrowDifferent() {
+ function a() { b(); }
+ function b() {
+ try {
+ c();
+ } catch (e) {
+ throw new Error();
+ }
+ }
+ function c() { throw new Error(); }
+
+ try {
+ a();
+ } catch (e) {}
+
+ debugger;
+}
+
+function throwInNewFunctionArgument() {
+ new Function("f=doesntExists()", "return 42;")();
+}
+
+function inlineExc() {
+ 'abc'.push(1);
+}
+
+inlineExc();