зеркало из https://github.com/mozilla/gecko-dev.git
Bug 447689 - clean up XMLHttpRequest::Open so XHR readyState=1 events are fired according to spec. r=baku
--HG-- extra : rebase_source : db3e4829a7f7b9cb3d1d9c179ef51c4845e840c3
This commit is contained in:
Родитель
dbd1a56877
Коммит
340717ad42
|
@ -1004,7 +1004,7 @@ XMLHttpRequestMainThread::GetStatusText(nsACString& aStatusText,
|
|||
}
|
||||
|
||||
void
|
||||
XMLHttpRequestMainThread::CloseRequestWithError(const ProgressEventType aType)
|
||||
XMLHttpRequestMainThread::CloseRequest()
|
||||
{
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_BINDING_ABORTED);
|
||||
|
@ -1012,6 +1012,13 @@ XMLHttpRequestMainThread::CloseRequestWithError(const ProgressEventType aType)
|
|||
if (mTimeoutTimer) {
|
||||
mTimeoutTimer->Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XMLHttpRequestMainThread::CloseRequestWithError(const ProgressEventType aType)
|
||||
{
|
||||
CloseRequest();
|
||||
|
||||
uint32_t responseLength = mResponseBody.Length();
|
||||
ResetResponse();
|
||||
|
||||
|
@ -1404,17 +1411,8 @@ XMLHttpRequestMainThread::Open(const nsACString& inMethod, const nsACString& url
|
|||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
if (mState == State::opened || mState == State::headers_received ||
|
||||
mState == State::loading) {
|
||||
// IE aborts as well
|
||||
Abort();
|
||||
|
||||
// XXX We should probably send a warning to the JS console
|
||||
// that load was aborted and event listeners were cleared
|
||||
// since this looks like a situation that could happen
|
||||
// by accident and you could spend a lot of time wondering
|
||||
// why things didn't work.
|
||||
}
|
||||
CloseRequest(); // spec step 10
|
||||
ResetResponse(); // (part of) spec step 11
|
||||
|
||||
mFlagSend = false;
|
||||
|
||||
|
@ -1542,7 +1540,9 @@ XMLHttpRequestMainThread::Open(const nsACString& inMethod, const nsACString& url
|
|||
}
|
||||
}
|
||||
|
||||
ChangeState(State::opened);
|
||||
if (mState != State::opened) {
|
||||
ChangeState(State::opened);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -761,6 +761,11 @@ protected:
|
|||
// that this request is associated with.
|
||||
nsCString mNetworkInterfaceId;
|
||||
|
||||
/**
|
||||
* Close the XMLHttpRequest's channels.
|
||||
*/
|
||||
void CloseRequest();
|
||||
|
||||
/**
|
||||
* Close the XMLHttpRequest's channels and dispatch appropriate progress
|
||||
* events.
|
||||
|
|
|
@ -1034,7 +1034,6 @@ Proxy::HandleEvent(nsIDOMEvent* aEvent)
|
|||
|
||||
if (!uploadTarget) {
|
||||
if (type.EqualsASCII(sEventStrings[STRING_loadstart])) {
|
||||
NS_ASSERTION(!mMainThreadSeenLoadStart, "Huh?!");
|
||||
mMainThreadSeenLoadStart = true;
|
||||
}
|
||||
else if (mMainThreadSeenLoadStart &&
|
||||
|
@ -1488,10 +1487,9 @@ SendRunnable::RunOnMainThread(ErrorResult& aRv)
|
|||
variant = wvariant;
|
||||
}
|
||||
|
||||
// Send() has been already called.
|
||||
// Send() has been already called, reset the proxy.
|
||||
if (mProxy->mWorkerPrivate) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
mProxy->Reset();
|
||||
}
|
||||
|
||||
mProxy->mWorkerPrivate = mWorkerPrivate;
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[open-open-send.htm]
|
||||
type: testharness
|
||||
[XMLHttpRequest: open() - open() - send()]
|
||||
expected: FAIL
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
[open-open-sync-send.htm]
|
||||
type: testharness
|
||||
[XMLHttpRequest: open() - open() (sync) - send()]
|
||||
expected: FAIL
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
[open-send-open.htm]
|
||||
type: testharness
|
||||
[XMLHttpRequest: open() - send() - open()]
|
||||
expected: FAIL
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
[open-sync-open-send.htm]
|
||||
type: testharness
|
||||
[XMLHttpRequest: open() (sync) - send() - open()]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче