You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
553 B

node.mixin(require("common.js"));
var cancelFired = false;
var promise = new node.Promise();
promise.addCallback(function() {
assertUnreachable('addCallback should not fire after promise.cancel()');
});
promise.addErrback(function() {
assertUnreachable('addErrback should not fire after promise.cancel()');
});
promise.addCancelback(function() {
cancelFired = true;
});
promise.cancel();
setTimeout(function() {
promise.emitSuccess();
promise.emitError();
}, 100);
process.addListener('exit', function() {
assertTrue(cancelFired);
});