Bug 791215 - Fix RangeError in fake crashreport server when the request body is too big. r=ted

This commit is contained in:
Georg Fritzsche 2012-09-17 19:47:14 +02:00
Родитель 4cc66c38b4
Коммит d47a7a81a3
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -56,9 +56,16 @@ function parseMultipartForm(request)
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;