Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Initializing qq.FineUploader from nested frame breaks qq.isObject #866

Closed
ianmstew opened this issue May 30, 2013 · 6 comments
Closed

Initializing qq.FineUploader from nested frame breaks qq.isObject #866

ianmstew opened this issue May 30, 2013 · 6 comments
Assignees
Milestone

Comments

@ianmstew
Copy link

Browser: Firefox 21
OS: Windows 7 64
FineUploader 3.5.0 pure javascript

Dear fine-uploader,

I absolutely love your widget. I have not found another universally (IE7+) compatible library with extensive drag-drop + fallback support, let alone one with the sophistication, configurability, and simplicity that fine-uploader provides.

I did run into one issue, though, which is an edge case for sure. We use GWT, which is Java code compiled to Javascript (as you likely know). GWT allows for native Javascript code in "native" functions, in which I initialize fine-uploader.

Native functions are executed in a nested frame and passed a reference to the top window, which I discovered introduces a bug in fine-uploader pure javascript version. qq.extend relies on qq.isObject, but isObject breaks when the initializing object comes from a different Window context.

Here's my setup (please excuse the pseudocode, but the GWT compilation is not so clean):

-html-
[include fine-uploader javascript]
[fine-uploader widget markup]
-iframe-
-script-
var uploader = new qq.FineUploader({ params... })
-/script-
-/iframe-
-/html-

Issue and fix:

image

Object constructor comparison doesn't work when object is instantiated in a different window, shown by firebug console executed during above breakpoint:

image

Thanks for checking into this!

Ian

@rnicholus
Copy link
Member

I already corrected a similar issue #758. The easiest way to fix this is probably to take a similar approach. That is, change:

maybeObj.constructor === Object

to:

Object.prototype.toString.call(maybeObj) === '[object Object]'

@ianmstew
Copy link
Author

Thanks, good call. That would be nice and inline and do the job with less.

@rnicholus
Copy link
Member

I'll look into this more during the current release cycle. Perhaps you
could confirm if that change addresses your issue as well. It should be
fairly easy to modify the code and try that out.

On Thu, May 30, 2013 at 4:32 PM, ianmstew notifications@github.com wrote:

Thanks, good call. That would be nice and inline and do the job with less.


Reply to this email directly or view it on GitHubhttps://github.com//issues/866#issuecomment-18709853
.

@ianmstew
Copy link
Author

Just did. I applied the change you suggested and fine-uploader works perfectly in our application (without the extra jquery code).

@rnicholus
Copy link
Member

Great. Thanks for the confirmation. I'll look into this further on my end
during the 3.7 release cycle, which will start in a day or two.

On Thu, May 30, 2013 at 4:48 PM, ianmstew notifications@github.com wrote:

Just did. I applied the change you suggested and fine-uploader works
perfectly in our application (without the extra jquery code).


Reply to this email directly or view it on GitHubhttps://github.com//issues/866#issuecomment-18710696
.

@ianmstew
Copy link
Author

Perfect, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants