summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-06.js
blob: 4ed8947ab8af7dcec60cc6fe331fa264a19cee5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Resumption values from onPromiseSettled handlers are disallowed.

load(libdir + 'asserts.js');

var g = newGlobal({newCompartment: true});
var dbg = new Debugger(g);
var log;

dbg.onPromiseSettled = function (g) { log += 's'; return undefined; };
log = '';
g.settlePromiseNow(new g.Promise(function (){}));
assertEq(log, 's');

dbg.uncaughtExceptionHook = function (ex) { assertEq(/disallowed/.test(ex), true); log += 'u'; }
dbg.onPromiseSettled = function (g) { log += 's'; return { return: "snoo" }; };
log = '';
g.settlePromiseNow(new g.Promise(function (){}));
assertEq(log, 'su');

dbg.onPromiseSettled = function (g) { log += 's'; return { throw: "snoo" }; };
log = '';
g.settlePromiseNow(new g.Promise(function (){}));
assertEq(log, 'su');

dbg.onPromiseSettled = function (g) { log += 's'; return null; };
log = '';
g.settlePromiseNow(new g.Promise(function (){}));
assertEq(log, 'su');

dbg.uncaughtExceptionHook = function (ex) { assertEq(/foopy/.test(ex), true); log += 'u'; }
dbg.onPromiseSettled = function (g) { log += 's'; throw "foopy"; };
log = '';
g.settlePromiseNow(new g.Promise(function (){}));
assertEq(log, 'su');