Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does xdomain support uploads and FormData? #36

Closed
AdamQuadmon opened this issue Jan 25, 2014 · 12 comments
Closed

Does xdomain support uploads and FormData? #36

AdamQuadmon opened this issue Jan 25, 2014 · 12 comments
Labels

Comments

@AdamQuadmon
Copy link

Hi Jamie,
I'm trying to upload files under xdomain but seems xdomain is not handling the file.
In a first place I thought was an issue with another XHR see this issue.

But then I realize the issue is the same even without the XHR hack.

I saw xHook 1.1 is handling upload stuff but xDomain 0.5 is still not using it!

Then I saw your 0.6 version of xDomain that seems to be intended to solve this issues.

I'm wrong?

  • is there a way to handle files upload now (with 0.5)?
  • if not, how can we help you in the 0.6 version of xDomain?

we really need it so please tell me how can I help to put 0.6 out!

Thanks for the library and for helping

@jpillora
Copy link
Owner

XHook 1.1 fixes a few bugs and is now handling more event types, though for FormData, I'm going to change the XDomain postMessage internals to use objects when possible, which should make XHR2 features functional with the release of 0.6

Thanks for the offer though I think I've nearly got it :)

@jpillora
Copy link
Owner

jpillora commented Feb 1, 2014

Hey I just released 0.6, I've done some basic testing for FormData though it'll probably need more, Strings and Blobs should work, still working on Files

@igormisha
Copy link

I tested last version of xdomain (v.0.6.2) to upload file and found that in chrome this works fine, but in firefox (v.27.0.1) I always get error (DataCloneError: The object could not be cloned.) in line 635: d = JSON.parse(d); when I try to upload first time. And all subsequent tries end up with the same error (DataCloneError: The object could not be cloned.) but in line 692: frame.postMessage(args, "*");

Also it works in IE11.

Without file upload all GET and POST requests go smoothly.
In my case the slave domain was a subdomain of the master domain (for clarification).

@jpillora jpillora added Bug and removed Enhancement labels Mar 3, 2014
@jpillora
Copy link
Owner

jpillora commented Mar 3, 2014

I had a look into this. Firefox can't send Blobs over postMessage (DataCloneError), though UInt8Array works. So the solution is to convert it Blobs to UInt8Arrays then back again.

Before I emit the request object I'll need to convert the request.body.entries.

@igormisha
Copy link

Wait for next release to test it!

@jpillora
Copy link
Owner

jpillora commented Mar 3, 2014

I just released a few bug fixes and minor changes, though didn't have time for this. Will post back here when I do 👍

@dcrockwell
Copy link

+1 for this feature/fix.

@devand123
Copy link

+1

@mrtnsn
Copy link

mrtnsn commented Apr 9, 2014

+1 for this fix

@brian-mann
Copy link
Contributor

+1 really need this!

@brian-mann
Copy link
Contributor

#64 Might give you some ideas. Looks like it works.

@jpillora
Copy link
Owner

Hey all, this feature has finally landed with v0.6.8, sorry for the delay :)

Please test it out here: http://jpillora.com/xdomain/example/formdata/

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

No branches or pull requests

7 participants