fix: Promise .then() must ignore non-function handlers per Promises/A+ 2.2.1#509
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #509 +/- ##
==========================================
- Coverage 97.56% 97.49% -0.08%
==========================================
Files 27 27
Lines 1439 1438 -1
Branches 336 338 +2
==========================================
- Hits 1404 1402 -2
- Misses 35 36 +1
🚀 New features to boost your workflow:
|
nev21
previously approved these changes
May 19, 2026
…+ 2.2.1 When .then() receives a non-function, non-undefined handler, it incorrectly uses the handler value as the resolved value instead of passing through the settled value. This violates Promises/A+ spec section 2.2.1 which states that non-function handlers must be ignored. Changes: - Use isFunction(handler) check instead of isUndefined(handler) to determine whether to invoke the handler or pass through the settled value - Use isFunction(handler) instead of truthy check to determine the resolve/ reject path for the chained promise - Increase idle promise test timeout from 10s to 30s to account for requestIdleCallback deferral in headless browsers
nev21
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When .then() receives a non-function, non-undefined handler, it incorrectly uses the handler value as the resolved value instead of passing through the settled value. This violates Promises/A+ spec section 2.2.1 which states that non-function handlers must be ignored.
Changes: