From 69a2d27a2387b85dc7b59bb99eef5660dc479147 Mon Sep 17 00:00:00 2001 From: Les De Ridder Date: Tue, 7 Jun 2016 08:26:07 +0200 Subject: [PATCH] Work around https://bugzilla.mozilla.org/show_bug.cgi?id=1085060 --- formdata.js | 10 ++++++++-- worker.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/formdata.js b/formdata.js index 923f24a..719b4f8 100644 --- a/formdata.js +++ b/formdata.js @@ -28,7 +28,7 @@ exports.FormData = FormData; var ___send$rw = XMLHttpRequest.prototype.send; - XMLHttpRequest.prototype.send = function(data) { + XMLHttpRequest.prototype.send2 = function(data) { if (data instanceof FormData) { if (!data.__endedMultipart) data.__append('--' + data.boundary + '--\r\n'); data.__endedMultipart = true; @@ -36,7 +36,13 @@ data = new Uint8Array(data.data); } // Invoke original XHR.send - return ___send$rw.call(this, data); + + //https://bugzilla.mozilla.org/show_bug.cgi?id=1085060 + var copy = new ArrayBuffer(data.byteLength); + new Uint8Array(copy).set(new Uint8Array(data)); + + console.log("sending"); + return this.send(copy); }; function FormData() { diff --git a/worker.js b/worker.js index f1eaf23..5dece29 100644 --- a/worker.js +++ b/worker.js @@ -26,5 +26,5 @@ function uploadBuffer(pomfclone, buffer, filename) { request.onload = function(e) { postMessage(request.response); }; - request.send(formData); + request.send2(formData); };