diff options
Diffstat (limited to 'js/src/jit-test/tests/debug/Debugger-onNewPromise-06.js')
-rw-r--r-- | js/src/jit-test/tests/debug/Debugger-onNewPromise-06.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Debugger-onNewPromise-06.js b/js/src/jit-test/tests/debug/Debugger-onNewPromise-06.js new file mode 100644 index 000000000..7e5b9927a --- /dev/null +++ b/js/src/jit-test/tests/debug/Debugger-onNewPromise-06.js @@ -0,0 +1,37 @@ +// Resumption values from onNewPromise handlers are disallowed. +if (!('Promise' in this)) + quit(0); + +load(libdir + 'asserts.js'); + +var g = newGlobal(); +var dbg = new Debugger(g); +var log; + +dbg.onNewPromise = function (g) { log += 'n'; return undefined; }; +log = ''; +assertEq(typeof new g.Promise(function (){}), "object"); +assertEq(log, 'n'); + +dbg.uncaughtExceptionHook = function (ex) { assertEq(/disallowed/.test(ex), true); log += 'u'; } +dbg.onNewPromise = function (g) { log += 'n'; return { return: "snoo" }; }; +log = ''; +assertEq(typeof new g.Promise(function (){}), "object"); +assertEq(log, 'nu'); + +dbg.onNewPromise = function (g) { log += 'n'; return { throw: "snoo" }; }; +log = ''; +assertEq(typeof new g.Promise(function (){}), "object"); +assertEq(log, 'nu'); + +dbg.onNewPromise = function (g) { log += 'n'; return null; }; +log = ''; +assertEq(typeof new g.Promise(function (){}), "object"); +assertEq(log, 'nu'); + +dbg.uncaughtExceptionHook = function (ex) { assertEq(/foopy/.test(ex), true); log += 'u'; } +dbg.onNewPromise = function (g) { log += 'n'; throw "foopy"; }; +log = ''; +assertEq(typeof new g.Promise(function (){}), "object"); +assertEq(log, 'nu'); + |