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:
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/

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

http://wiki.jqueryui.com/w/page/12138135/Widget-factory

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: https://github.com/scottgonzalez/widget-factory-docs/commit/9cae83cbb08d5fcc72ab11022262141e7107fb91

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

Thanks. :)