xdomain icon indicating copy to clipboard operation
xdomain copied to clipboard

Bug: Properly serialize and deserialize "Blob" and "File" on Firefox

Open iameli opened this issue 9 years ago • 6 comments

Hi,

It looks like xdomain handles the contents of FormData properly, but I'm working with an API where we pass raw data around sometimes -- Blob and File types. This works fine with Chrome and IE10 but fails on Firefox (DataCloneError) with their longstanding Blob postMessage nonsense. https://bugzilla.mozilla.org/show_bug.cgi?id=722126

I'm looking at the stuff that serializes and deserializes FormData on the masters and slaves -- I think adding support for Blob and File wouldn't be too difficult -- it's the same method, just without the FormData wrapper. Probably I'll submit a PR this weekend if I'm on the right track here.

Thanks!

iameli avatar Oct 10 '14 20:10 iameli

It should already be converting files and blobs to a uint8array, let me read through the code though, haven't looked at it for quite a while

On Saturday, October 11, 2014, Eli Mallon [email protected] wrote:

Hi,

It looks like xdomain handles the contents of FormData properly, but I'm working with an API where we pass raw data around sometimes -- Blob and File types. This works fine with Chrome and IE10 but fails on Firefox (DataCloneError) with their longstanding Blob postMessage nonsense. https://bugzilla.mozilla.org/show_bug.cgi?id=722126

I'm looking at the stuff that serializes and deserializes FormData on the masters and slaves -- I think adding support for Blob and File wouldn't be too difficult -- it's the same method, just without the FormData wrapper. Probably I'll submit a PR this weekend if I'm on the right track here.

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/jpillora/xdomain/issues/119.

jpillora avatar Oct 11 '14 00:10 jpillora

ahh I see, you'd like to xhr.send(file || blob) sorry, didnt see the second paragraph, PR away :)

jpillora avatar Oct 11 '14 12:10 jpillora

Getting the following in IE9:

SCRIPT5034: Circular reference in value argument not supported
File: xdomain.js, Line: 842, Column: 7

sgarbesi avatar Nov 04 '14 23:11 sgarbesi

@sgarbesi http://caniuse.com/formdata it's not supported by IE[89]

jpillora avatar Nov 05 '14 02:11 jpillora

HI, Before including Xdomain.min.js in the project while fetching the stream(MemoryStream) response from WEB API using ActionResult and then converted that blob data using below code snippet into pdf file format.

var blob = new Blob([res._body], { type: 'application/pdf' }); this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(window.URL.createObjectURL(blob)); if (callingFrom === 'download') { let element = this.downloadLink.nativeElement; element.href = this.fileUrl.changingThisBreaksApplicationSecurity; element.click(); } Once I include Xdomain plugin in the project to fix CORS issue stream response is getting junk like below: image

Please help me in this It's taking time but coundn't find any solution. Please respond AQAP.

Thanks in advance.

udayklu avatar Aug 28 '19 12:08 udayklu

image

udayklu avatar Aug 28 '19 12:08 udayklu