b=873757; crash in JSStructuredCloneWriter::writeArrayBuffer; r=bz

This commit is contained in:
Vladimir Vukicevic 2013-05-23 22:09:38 -04:00
parent 262e16d802
commit 7b3cd12107
2 changed files with 4 additions and 1 deletions

View File

@ -3466,6 +3466,7 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
mResponseBody.Truncate();
mResponseText.Truncate();
mResultArrayBuffer = nullptr;
mArrayBufferBuilder.reset();
}
}

View File

@ -1064,7 +1064,9 @@ class ArrayBufferBuilder
}
JSObject* getArrayBuffer(JSContext *cx) {
if (capacity_ > length_) {
// we need to check for length_ == 0, because nothing may have been
// added
if (capacity_ > length_ || length_ == 0) {
if (!setCapacity(length_))
return NULL;
}