Skip to main content

Search and Top Navigation

#7991 closed bug (notabug)

Opened January 06, 2012 07:22AM UTC

Closed January 06, 2012 02:44PM UTC

Last modified January 06, 2012 03:37PM UTC

Upload Progress Event Trigger Exception

Reported by: madblueimp Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.widget Version: 1.8.17
Keywords: Cc:
Blocked by: Blocking:

Passing an upload progress event object to the _trigger method of the Widget Factory causes the following exception in Mozilla Firefox (tested with Firefox v. 9.0.1 on Mac OSX 10.6.8):

[Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMLSProgressEvent.input]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: :: <TOP_LEVEL> :: line 259" data: no]

jsFiddle Test case:

Attachments (0)
Change History (4)

Changed January 06, 2012 02:44PM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

This occurs because Firefox provides an input property on the progress event, but doesn't actually implement it and instead throws an error if it's accessed.

_trigger() is only meant to receive jQuery events, not native events. You should bind to the progress event with $( xhr.upload ).bind( "progress", ... ) and pass the jQuery event to _trigger(). If you want the progress-specific event properties to be copied to the new event, you'll need to define $.event.fixHooks.progress. The minimal implementation for your test case would be:

$.event.fixHooks.progress = {
    props: ["loaded"]

Changed January 06, 2012 03:18PM UTC by madblueimp comment:2

Thanks, understood.

I think the _trigger documentation on the Wiki page is a bit misleading, if only jQuery events are expected:

"You may also provide an event object that represents the event that initiated the process. For example, a drag event is initiated by a mousemove event, so the original mousemove event object must be passed in to _trigger."

Changed January 06, 2012 03:34PM UTC by scottgonzalez comment:3

Yes, that's definitely misleading and the newer WIP docs were actually wrong. I've updated the WIP:

Changed January 06, 2012 03:37PM UTC by madblueimp comment:4

Thanks. :)