The wrapped handler fails the handler === finallyHandler check in Promise.prototype._settlePromise.
To repro, add this test case to the cancel.js test:
if (testUtils.isNodeJS) {
specify("cancels the promise chain within a domain", function() {
var called = false;
var thens = 0;
var resolveChain;
require("domain").create().enter();
var root = new Promise(function(resolve, reject, onCancel) {
resolveChain = resolve;
onCancel(function() {
called = true;
});
}).then(function() {
thens++;
}).then(function() {
thens++;
}).then(function() {
thens++;
});
root.cancel();
resolveChain();
return awaitLateQueue(function() {
assert.equal(0, thens);
assert(called);
});
});
}
The wrapped handler fails the
handler === finallyHandlercheck inPromise.prototype._settlePromise.To repro, add this test case to the cancel.js test: