Bug 703380 - Worker part; r=bent

--HG--
extra : rebase_source : c3072ce5046ed2199e10d42c5d7732501c7551bf
This commit is contained in:
Masatoshi Kimura 2011-11-21 12:07:15 -06:00
Родитель d607eea98c
Коммит 7fec8cc9b9
2 изменённых файлов: 20 добавлений и 10 удалений

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

@ -566,6 +566,19 @@ public:
mProxy->mSeenLoadStart = false;
}
}
else if (mType.EqualsASCII(sEventStrings[STRING_abort])) {
if ((mUploadEvent && !mProxy->mSeenUploadLoadStart) ||
(!mUploadEvent && !mProxy->mSeenLoadStart)) {
// We've already dispatched premature abort events.
return true;
}
}
else if (mType.EqualsASCII(sEventStrings[STRING_readystatechange])) {
if (mReadyState == 4 && !mUploadEvent && !mProxy->mSeenLoadStart) {
// We've already dispatched premature abort events.
return true;
}
}
if (mProgressEvent) {
// Cache these for premature abort events.
@ -1533,7 +1546,7 @@ XMLHttpRequestPrivate::Abort(JSContext* aCx)
}
if (mProxy) {
if (!MaybeDispatchPrematureAbortEvents(aCx, false)) {
if (!MaybeDispatchPrematureAbortEvents(aCx)) {
return false;
}
}
@ -1619,7 +1632,7 @@ XMLHttpRequestPrivate::Open(JSContext* aCx, JSString* aMethod, JSString* aURL,
}
if (mProxy) {
if (!MaybeDispatchPrematureAbortEvents(aCx, true)) {
if (!MaybeDispatchPrematureAbortEvents(aCx)) {
return false;
}
}
@ -1831,8 +1844,7 @@ XMLHttpRequestPrivate::OverrideMimeType(JSContext* aCx, JSString* aMimeType)
}
bool
XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx,
bool aFromOpen)
XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx)
{
mWorkerPrivate->AssertIsOnWorkerThread();
NS_ASSERTION(mProxy, "Must have a proxy here!");
@ -1865,11 +1877,9 @@ XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx,
return false;
}
if (aFromOpen) {
if (!DispatchPrematureAbortEvent(aCx, target, STRING_abort, false) ||
!DispatchPrematureAbortEvent(aCx, target, STRING_loadend, false)) {
return false;
}
if (!DispatchPrematureAbortEvent(aCx, target, STRING_abort, false) ||
!DispatchPrematureAbortEvent(aCx, target, STRING_loadend, false)) {
return false;
}
mProxy->mSeenLoadStart = false;

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

@ -155,7 +155,7 @@ private:
RootJSObject(JSContext* aCx);
bool
MaybeDispatchPrematureAbortEvents(JSContext* aCx, bool aFromOpen);
MaybeDispatchPrematureAbortEvents(JSContext* aCx);
bool
DispatchPrematureAbortEvent(JSContext* aCx, JSObject* aTarget,