summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js')
-rw-r--r--js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js b/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js
new file mode 100644
index 0000000000..4ef41cc67c
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js
@@ -0,0 +1,13 @@
+// Errors in onNewPromise handlers are reported correctly, and don't mess up the
+// promise creation.
+
+var g = newGlobal({newCompartment: true});
+var dbg = new Debugger(g);
+
+let e;
+dbg.uncaughtExceptionHook = ee => { e = ee; };
+dbg.onNewPromise = () => { throw new Error("woops!"); };
+
+assertEq(typeof new g.Promise(function (){}), "object");
+assertEq(!!e, true);
+assertEq(!!e.message.match(/woops/), true);