blob: 7e5b9927a318d495004e35b220e6cb31d21efc22 (
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
36
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');
|