Bug 1091002 - Drop loadend event to worker thread XHR if it's triggered by abort event from worker. r=khuey

This commit is contained in:
Shian-Yow Wu 2014-11-11 14:12:47 +08:00
parent da637fb319
commit c4e40ad333

View File

@ -1279,6 +1279,10 @@ EventRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
mProxy->mSeenUploadLoadStart = false; mProxy->mSeenUploadLoadStart = false;
} }
else { else {
if (!mProxy->mSeenLoadStart) {
// We've already dispatched premature abort events.
return true;
}
mProxy->mSeenLoadStart = false; mProxy->mSeenLoadStart = false;
} }
} }
@ -2404,7 +2408,9 @@ XMLHttpRequest::UpdateState(const StateData& aStateData,
bool aUseCachedArrayBufferResponse) bool aUseCachedArrayBufferResponse)
{ {
if (aUseCachedArrayBufferResponse) { if (aUseCachedArrayBufferResponse) {
MOZ_ASSERT(JS_IsArrayBufferObject(mStateData.mResponse.toObjectOrNull())); MOZ_ASSERT(mStateData.mResponse.isObject() &&
JS_IsArrayBufferObject(&mStateData.mResponse.toObject()));
JS::Rooted<JS::Value> response(mWorkerPrivate->GetJSContext(), JS::Rooted<JS::Value> response(mWorkerPrivate->GetJSContext(),
mStateData.mResponse); mStateData.mResponse);
mStateData = aStateData; mStateData = aStateData;