New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finally not called on cancel when Node.js domain is active (i.e. process.domain !== undefined) #963

Closed
heskew opened this Issue Jan 15, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@heskew

heskew commented Jan 15, 2016

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);
            });
        });
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment