Side navigation
#11405 closed bug (fixed)
Opened February 27, 2012 08:58PM UTC
Closed December 07, 2012 02:14PM UTC
deferred.notify() invokes progressCallbacks with deferred as context
Reported by: | fastfasterfastest | Owned by: | jaubourg |
---|---|---|---|
Priority: | high | Milestone: | 1.9 |
Component: | deferred | Version: | 1.7.1 |
Keywords: | Cc: | jaubourg | |
Blocked by: | Blocking: |
Description
http://api.jquery.com/deferred.promise states:
"The deferred.promise() method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request"
However, deferred.notify() invokes progressCallbacks with the deferred as the context, allowing other code to interfere with the progress or status of the internal request of the deferred object.
http://jsfiddle.net/d92Rp/1/ shows how a progress callback is able to reject a deferred.
Arguably, it would make more sense to invoke the progressCallbacks with the promise of the deferred (deferred.promise()) as the context.
The same perhaps/probably applies to deferred.resolve() and deferred.reject(), although in those cases any calls by the done or fail callbacks to resolve or reject would have no effect.
Attachments (0)
Change History (6)
Changed March 10, 2012 02:10PM UTC by comment:1
cc: | → jaubourg |
---|---|
component: | unfiled → ajax |
priority: | undecided → low |
Changed April 24, 2012 07:28PM UTC by comment:2
"Component" should probably be "deferred" (as opposed to "ajax")
Changed April 24, 2012 07:31PM UTC by comment:3
owner: | → jaubourg |
---|---|
status: | new → assigned |
Changed October 16, 2012 08:11PM UTC by comment:4
component: | ajax → deferred |
---|
Changed December 04, 2012 05:24AM UTC by comment:5
milestone: | None → 1.9 |
---|---|
priority: | low → high |
Changed December 07, 2012 02:14PM UTC by comment:6
resolution: | → fixed |
---|---|
status: | assigned → closed |
Deferred: .resolve(), .reject() and .notify() now set the callback context to the promise instance rather than the deferred instance ; .then() has also been amended. Fixes #11405.
Changeset: 23d7cf0488bfeaab51d8f55435cab01f5cf990ca