summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/examples/exceptions.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /devtools/client/debugger/test/mochitest/examples/exceptions.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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();