summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js')
-rw-r--r--js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js
new file mode 100644
index 0000000000..b78cbccf11
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Debugger-onPromiseSettled-02.js
@@ -0,0 +1,24 @@
+// onPromiseSettled handlers fire, until they are removed.
+
+var g = newGlobal({newCompartment: true});
+var dbg = new Debugger(g);
+var log;
+
+log = '';
+g.settlePromiseNow(new g.Promise(function (){}));
+assertEq(log, '');
+
+dbg.onPromiseSettled = function (promise) {
+ log += 's';
+ assertEq(promise.seen, undefined);
+ promise.seen = true;
+};
+
+log = '';
+g.settlePromiseNow(new g.Promise(function (){}));
+assertEq(log, 's');
+
+log = '';
+dbg.onPromiseSettled = undefined;
+g.settlePromiseNow(new g.Promise(function (){}));
+assertEq(log, '');