Skip to content
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

Fix unhandled promise rejection handler after a .then #1469

Merged
merged 1 commit into from
May 3, 2024

Conversation

andreabergia
Copy link
Contributor

If we have a promise p1 that is rejected, and invoke then on it, we create a new promise p2 (as it should be, per the spec) and mark p1 as handled. However, if we call .catch on p2, we are not marking p1 as handled correctly since its status is "pending" and not "rejected". This patch fixes it and adds some tests.

Fixes #1461

If we have a promise `p1` that is rejected, and invoke `then` on it,
we create a new promise `p2` (as it should be, per the spec) and mark
`p1` as handled. However, if we call `.catch` on `p2`, we are _not_
marking `p1` as handled correctly since its status is "pending" and
not "rejected". This patch fixes it and adds some tests.

Fixes mozilla#1461
@rbri
Copy link
Collaborator

rbri commented Apr 30, 2024

LGTM thanks a lot for this contribution

@gbrail
Copy link
Collaborator

gbrail commented May 3, 2024

Thanks -- I agree that it looks good!

@gbrail gbrail merged commit 15abaad into mozilla:master May 3, 2024
3 checks passed
@andreabergia andreabergia deleted the fix-1461 branch May 6, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promise behaviour
3 participants