Opened 8 years ago

Closed 8 years ago

Last modified 8 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:

Description

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 :: https://raw.github.com/jquery/jquery-ui/1.8.17/ui/jquery.ui.widget.js :: <TOP_LEVEL> :: line 259" data: no]

jsFiddle Test case: http://jsfiddle.net/X64wL/2/

Change History (4)

comment:1 Changed 8 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 8 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." http://wiki.jqueryui.com/w/page/12138135/Widget-factory

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

Yes, that's definitely misleading and the newer WIP docs were actually wrong. I've updated the WIP: https://github.com/scottgonzalez/widget-factory-docs/commit/9cae83cbb08d5fcc72ab11022262141e7107fb91

comment:4 Changed 8 years ago by madblueimp

Thanks. :)

Note: See TracTickets for help on using tickets.