Skip to content

Deferred: Don't unwrap a thenable that is this promise - #5902

Open
arronKler wants to merge 1 commit into
jquery:mainfrom
arronKler:fix/5534-animation-promise-loop
Open

arronKler wants to merge 1 commit into
jquery:mainfrom
arronKler:fix/5534-animation-promise-loop

Conversation

@arronKler

Copy link
Copy Markdown

Summary

Calling .then() on an animation from start (or on any deferred that notifys with itself) looped inside Deferred/Callbacks until the tab ran out of memory.

.then() forwards progress through Identity. Animation's first progress value is the animation promise, so Identity returned that same thenable and then() attached another progress handler. Progress has memory, so the handler ran again immediately.

Skip thenable unwrapping when the returned then is this promise's own then. Foreign thenables still unwrap, including the existing "implicit progress callbacks unwrap thenables" tests.

Fixes #5534

Checklist

Animation notifies progress with the animation object, which is the
same promise `.then()` was called on. Identity treated that value as
a thenable and called `.then()` again, re-attaching progress handlers.
Because progress has memory, this looped until the tab crashed.

Skip thenable adoption when the returned `then` is this promise's own
`then`.

Fixes jquery#5534
Fixes jquerygh-5534
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@arronKler

Copy link
Copy Markdown
Author

recheck

@mgol

mgol commented Sep 25, 2026

Copy link
Copy Markdown
Member

The CLA check is still not passing, please sign the CLA; only then we can consider your contribution.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Animation promise gets stuck in infinite loop, eventually crashing the browser

2 participants