jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 270 forks source link

"TypeError: Argument 1 of FormData.constructor is not an object." #107

Closed TheDom closed 9 years ago

TheDom commented 10 years ago

We are using Dropzone to upload images onto a different domain as multipart/form-data.

xdomain on Firefox 24 (on Windows) throws the following error though

TypeError: Argument 1 of FormData.constructor is not an object.

This occurs on line 221:

this.fd = new xhook[FormData](form);

It's true, form is undefined at this point, also on Firefox 31.0 (OS X) but there everything works just fine.

I patched this line to:

this.fd = (form ? new xhook[FormData](form) : new xhook[FormData]());

Now the upload works but I'm not sure what other consequences this might bring or why this error occurs in the first place (or how it could be avoided).

Any ideas?

jpillora commented 10 years ago

Ah yep - that's probably the right fix. Looks like some browsers don't like undefined in there.

jpillora commented 10 years ago

Will look into this soon

TheDom commented 10 years ago

Thanks!

pswai commented 9 years ago

https://github.com/jpillora/xdomain/blob/gh-pages/dist/0.6/xdomain.js#L220 does not seem to have the fix of FF24.

jpillora commented 9 years ago

Fixing

jpillora commented 9 years ago

Fixed, forgot to rebuild with the new xhook version >.<

TheDom commented 9 years ago

Thanks for taking care of this!

pswai commented 9 years ago

Great! Thanks :+1: