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.js15
1 files changed, 15 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 000000000..495f356c6
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js
@@ -0,0 +1,15 @@
+// Errors in onNewPromise handlers are reported correctly, and don't mess up the
+// promise creation.
+if (!('Promise' in this))
+ quit(0);
+
+var g = newGlobal();
+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);