jpillora / xdomain

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

Does xdomain support File Transfers? #97

Closed boroth closed 9 years ago

boroth commented 10 years ago

I'm attempting to transfer a file via FormData (using the ng-file-upload module for AngularJS), and getting the following error from xdomain (line 834):

Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': An object could not be cloned.

As far as I can tell, ArrayBuffers and Blobs can be sent via the postMessage function (from http://www.w3.org/TR/2012/WD-webmessaging-20120313/#posting-messages), but I don't know enough about the socket api

Here's a sample request I tried to make (it's the args variable that's being sent through to postMessage):

[
   "xdomain-f4bdbece",
   "request",
   {
      "method":"POST",
      "url":"http://my-local-apimessages/253/notes/mixed",
      "withCredentials":false,
      "headers":{
         "authorization":"Bearer accessToken",
         "context-organization":"myContextOrg",
         "accept":"application/json, text/plain, */*"
      },
      "body":[
         "XD_FD",
         [
            [
               "form[note]",
               ""
            ],
            [
               "form[by_user_id]",
               17
            ],
            [
               "form[media:is_public]",
               1
            ],
            [
               "form[media:enabled]",
               "1"
            ],
            [
               "form[media:name][0]",
               ""
            ],
            [
               "form[media:description][0]",
               ""
            ],
            [
               "form[media:provider][0]",
               "image"
            ],
            [
               "XD_BLOB",
               [
                  "form[media:binary_content][]",
                  null,
                  "Bob's_Burgers_promo.png"
               ],
               {

               },
               "image/png"
            ]
         ]
      ]
   }
]
jpillora commented 10 years ago

Is this under IE8 and 9? If so see this thread https://github.com/jpillora/xdomain/issues/74#issuecomment-49135969

uteq commented 9 years ago

I am having the same problem. This is not in IE8 or IE9. I'm running the current Google Chrome Version 40.0.2214.111 (64-bit).

I simply implemented the angular-file-upload.min.js v3.0.2 module and xdomain.min.js v0.6.17

jpillora commented 9 years ago

I'll try debugging it if you can create a live version? You can email me the link if you want to keep it private

uteq commented 9 years ago

Thank you! If I'm right, you've received an email.

jpillora commented 9 years ago

I did, I just forgot about it! Will check out the link now

On Thursday, February 12, 2015, Ganganation notifications@github.com wrote:

Thank you! If I'm right, you've received an email.

— Reply to this email directly or view it on GitHub https://github.com/jpillora/xdomain/issues/97#issuecomment-73886545.

theRichu commented 9 years ago

Same here :( Any progress?

AndrewAskins commented 8 years ago

Hey, just wanted to check to see if there was a fix for this at any point? I'm running into the same issue using dropzone.js with Ember.js and the current version of Chrome. The strange part is I've used dropzone in an ember app before with xdomain and had no issues. Probably means there's a problem with my configuration or something but I'm at a bit of a loss so I thought I'd check.

anandaanv commented 6 years ago

Hi.. is this issue solved by any chance?