Les De Ridder 4 years ago
parent
commit
69a2d27a23
2 changed files with 9 additions and 3 deletions
  1. +8
    -2
      formdata.js
  2. +1
    -1
      worker.js

+ 8
- 2
formdata.js View File

@@ -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() {


+ 1
- 1
worker.js View File

@@ -26,5 +26,5 @@ function uploadBuffer(pomfclone, buffer, filename) {
request.onload = function(e) {
postMessage(request.response);
};
request.send(formData);
request.send2(formData);
};

Loading…
Cancel
Save