-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Deferred: fix memory leak of promise callbacks #3657
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
|
@jbedard, thanks for your PR! By analyzing the history of the files in this pull request, we identified @gibson042, @jaubourg and @markelog to be potential reviewers. |
|
No tests? There is also code-style issue |
|
I wasn't really sure how this could be unit tested. Any ideas? With everything hidden in closures it's a little hard to do things like spy on the callback methods... |
src/deferred.js
Outdated
| tuples[ 0 ][ 2 ].lock | ||
| ); | ||
|
|
||
| tuple[ 3 ].add( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right to me; I think we should do everything in the existing handler (i.e., it should disable both done callbacks and then callbacks, and lock both done and then progress notifications). We could probably also stand to improve the comments, since "callbacks" is ambiguous in light of done vs. then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean adding it to the list.add above? I'll try it out... I don't recall why I did it here :/
Yes, among other reasons. |
|
@gibson042 I've moved everything into the existing |
gibson042
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Interesting... I amended the commit just to add the PR number to the commit msg and one test started failing. Now I ran it again and everything passed. Anyone ever see something similar before? I can't seem to reproduce it locally. Here's the travis job that failed: https://travis-ci.org/jquery/jquery/jobs/242269140 The test failure: |
Fixes #3606
I'm not sure why we need both callbacks and .then handlers. Could we instead merge those
Callbacks? EDIT: I think it's because error handling works different?