-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Fix: Animation promise gets stuck in infinite loop, eventually crashing the browser #5627
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
Conversation
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
|
This PR heavily modifies Callbacks code in ways that break our test suite. The description also looks quite similar to what you can get out of various AI tools nowadays; did you work on it yourself? When submitting PRs, please make sure the proposed changes really solve the issue they claim they solve; the PR should pass tests, add new ones confirming the fix and it needs to pass existing tests. Also, changes should be as small as possible. Seeing a big PR failing tests I don’t really see a way to proceed. |
This pull request addresses an issue in the jQuery Deferred implementation where an infinite loop was being triggered when the
.then()statement was executed after an animation completion. This issue occurred because the state was being continuously set to "resolved," leading to unintended behavior and performance degradation.Changes Made:
1. Introduced Flag to Track State Resolution:
isResolvedOrRejectedwas introduced to track whether the deferred state has already been set to either "resolved" or "rejected." This ensures that once the state changes, further state transitions do not occur, preventing continuous updates.2. State Change Condition:
resolveWithandfireWith.3. Controlled Execution of
.then()Handlers:.then()handlers (which are responsible for resolving the deferred promise) are only executed once when the animation completes, thus preventing the infinite loop of state changes.4.Smoother Animation Execution:
Testing:
Fixes #5534