summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onNewPromise-02.js
blob: 61cb8f03eff99ac70bd492a95a49aa7dc0d926e4 (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
// onNewPromise handlers fire, until they are removed.

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

log = '';
new g.Promise(function (){});
assertEq(log, '');

dbg.onNewPromise = function (promise) {
  log += 'n';
  assertEq(promise.seen, undefined);
  promise.seen = true;
};

log = '';
new g.Promise(function (){});
assertEq(log, 'n');

log = '';
dbg.onNewPromise = undefined;
new g.Promise(function (){});
assertEq(log, '');