Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#7991 closed bug (notabug)

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:

Change History (4)

comment:1 Changed 9 years ago by Scott González

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"]

comment:2 Changed 9 years ago by madblueimp

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."

comment:3 Changed 9 years ago by Scott González

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

comment:4 Changed 9 years ago by madblueimp

Thanks. :)

Note: See TracTickets for help on using tickets.