summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onNewPromise-07.js
blob: 495f356c635432298be0923affab16ef91410308 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);