Bug 791215 - Fix RangeError in fake crashreport server when the request body is too big. r=ted
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Mon, 17 Sep 2012 19:47:14 +0200
changeset 107809 156f00b9ac9238a087a504371438e1c497af9e17
parent 107808 b461a7cd250e813aa920ebe6cbefb8112e554e10
child 107810 bafe7d48e4c5de20e28f688c19107240380a06c0
push id23510
push userkhuey@mozilla.com
push dateSat, 22 Sep 2012 22:46:15 +0000
treeherdermozilla-central@9d285bedbc1f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs791215
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 791215 - Fix RangeError in fake crashreport server when the request body is too big. r=ted
toolkit/crashreporter/test/browser/crashreport.sjs
--- a/toolkit/crashreporter/test/browser/crashreport.sjs
+++ b/toolkit/crashreporter/test/browser/crashreport.sjs
@@ -51,19 +51,26 @@ function parseMultipartForm(request)
     }
   }
   if (boundary == null)
     return null;
 
   let body = new BinaryInputStream(request.bodyInputStream);
   let avail;
   let bytes = [];
-  while ((avail = body.available()) > 0)
-    Array.prototype.push.apply(bytes, body.readByteArray(avail));
-  let data = String.fromCharCode.apply(null, bytes);
+  while ((avail = body.available()) > 0) {
+    let readBytes = body.readByteArray(avail);
+    for (let b of readBytes) {
+      bytes.push(b);
+    }
+  }
+  let data = "";
+  for (let b of bytes) {
+    data += String.fromCharCode(b);
+  }
   let formData = {};
   let done = false;
   let start = 0;
   while (true) {
     // read first line
     let end = data.indexOf("\r\n", start);
     if (end == -1) {
       done = true;