Skip to main content

Bug Tracker

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 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. 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 addyosmani comment:1

cc: → jaubourg
component: unfiledajax
priority: undecidedlow

Changed April 24, 2012 07:28PM UTC by fastfasterfastest comment:2

"Component" should probably be "deferred" (as opposed to "ajax")

Changed April 24, 2012 07:31PM UTC by rwaldron comment:3

owner: → jaubourg
status: newassigned

Changed October 16, 2012 08:11PM UTC by jaubourg comment:4

component: ajaxdeferred

Changed December 04, 2012 05:24AM UTC by gibson042 comment:5

milestone: None1.9
priority: lowhigh

Changed December 07, 2012 02:14PM UTC by jaubourg comment:6

resolution: → fixed
status: assignedclosed

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