зеркало из https://github.com/mozilla/pjs.git
Bug 703380 - Worker part; r=bent
--HG-- extra : rebase_source : c3072ce5046ed2199e10d42c5d7732501c7551bf
This commit is contained in:
Родитель
d607eea98c
Коммит
7fec8cc9b9
|
@ -566,6 +566,19 @@ public:
|
||||||
mProxy->mSeenLoadStart = false;
|
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) {
|
if (mProgressEvent) {
|
||||||
// Cache these for premature abort events.
|
// Cache these for premature abort events.
|
||||||
|
@ -1533,7 +1546,7 @@ XMLHttpRequestPrivate::Abort(JSContext* aCx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mProxy) {
|
if (mProxy) {
|
||||||
if (!MaybeDispatchPrematureAbortEvents(aCx, false)) {
|
if (!MaybeDispatchPrematureAbortEvents(aCx)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1619,7 +1632,7 @@ XMLHttpRequestPrivate::Open(JSContext* aCx, JSString* aMethod, JSString* aURL,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mProxy) {
|
if (mProxy) {
|
||||||
if (!MaybeDispatchPrematureAbortEvents(aCx, true)) {
|
if (!MaybeDispatchPrematureAbortEvents(aCx)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1831,8 +1844,7 @@ XMLHttpRequestPrivate::OverrideMimeType(JSContext* aCx, JSString* aMimeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx,
|
XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx)
|
||||||
bool aFromOpen)
|
|
||||||
{
|
{
|
||||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||||
NS_ASSERTION(mProxy, "Must have a proxy here!");
|
NS_ASSERTION(mProxy, "Must have a proxy here!");
|
||||||
|
@ -1865,11 +1877,9 @@ XMLHttpRequestPrivate::MaybeDispatchPrematureAbortEvents(JSContext* aCx,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFromOpen) {
|
if (!DispatchPrematureAbortEvent(aCx, target, STRING_abort, false) ||
|
||||||
if (!DispatchPrematureAbortEvent(aCx, target, STRING_abort, false) ||
|
!DispatchPrematureAbortEvent(aCx, target, STRING_loadend, false)) {
|
||||||
!DispatchPrematureAbortEvent(aCx, target, STRING_loadend, false)) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mProxy->mSeenLoadStart = false;
|
mProxy->mSeenLoadStart = false;
|
||||||
|
|
|
@ -155,7 +155,7 @@ private:
|
||||||
RootJSObject(JSContext* aCx);
|
RootJSObject(JSContext* aCx);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MaybeDispatchPrematureAbortEvents(JSContext* aCx, bool aFromOpen);
|
MaybeDispatchPrematureAbortEvents(JSContext* aCx);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DispatchPrematureAbortEvent(JSContext* aCx, JSObject* aTarget,
|
DispatchPrematureAbortEvent(JSContext* aCx, JSObject* aTarget,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче