Skip to content

Calling cancel more than once synchronously causes weird behavior #362

Closed
@nomcopter

Description

Adding the following tests to test/mocha/cancel.js demonstrates this behavior. With delay passes while Without delay fails.

describe("Cancelling a promise twice should have no additional effect", function() {
    specify("With delay", function(done) {
        var promise = pending().promise.cancellable().catch(function(){}).then(done).catch(function() { done(new Error('Should not be called')) });
        promise.cancel();
        setTimeout(function() {
            promise.cancel();
        }, 50);
    });
    specify("Without delay", function(done) {
        var promise = pending().promise.cancellable().catch(function(){}).then(done).catch(function() { done(new Error('Should not be called')) });
        promise.cancel()
        promise.cancel();
    });
});

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions