From fcc767c1d83e3cc99bc1cd3f93afbd7c18e45aad Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Tue, 15 Sep 2009 18:44:35 +0300 Subject: [PATCH] backout Bug 313646 --HG-- extra : rebase_source : 5ff7e3a019f140ef26f5ac14210e19ad382e65f8 --- content/base/src/nsXMLHttpRequest.cpp | 22 ++++------ content/base/test/Makefile.in | 2 - content/base/test/bug313646.txt | 1 - content/base/test/test_bug313646.html | 63 --------------------------- 4 files changed, 9 insertions(+), 79 deletions(-) delete mode 100644 content/base/test/bug313646.txt delete mode 100644 content/base/test/test_bug313646.html diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 3db78a2e5ef7..c11cf0cb45aa 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -2603,6 +2603,12 @@ nsXMLHttpRequest::Send(nsIVariant *aBody) return rv; } + // Now that we've successfully opened the channel, we can change state. Note + // that this needs to come after the AsyncOpen() and rv check, because this + // can run script that would try to restart this request, and that could end + // up doing our AsyncOpen on a null channel if the reentered AsyncOpen fails. + ChangeState(XML_HTTP_REQUEST_SENT); + // If we're synchronous, spin an event loop here and wait if (!(mState & XML_HTTP_REQUEST_ASYNC)) { mState |= XML_HTTP_REQUEST_SYNCLOOPING; @@ -2625,9 +2631,6 @@ nsXMLHttpRequest::Send(nsIVariant *aBody) } } - ChangeState(XML_HTTP_REQUEST_SENT); - // Note, calling ChangeState may have cleared - // XML_HTTP_REQUEST_SYNCLOOPING flag. nsIThread *thread = NS_GetCurrentThread(); while (mState & XML_HTTP_REQUEST_SYNCLOOPING) { if (!NS_ProcessNextEvent(thread)) { @@ -2644,11 +2647,6 @@ nsXMLHttpRequest::Send(nsIVariant *aBody) NS_DispatchToCurrentThread(resumeTimeoutRunnable); } } else { - // Now that we've successfully opened the channel, we can change state. Note - // that this needs to come after the AsyncOpen() and rv check, because this - // can run script that would try to restart this request, and that could end - // up doing our AsyncOpen on a null channel if the reentered AsyncOpen fails. - ChangeState(XML_HTTP_REQUEST_SENT); if (!mUploadComplete && HasListenersFor(NS_LITERAL_STRING(UPLOADPROGRESS_STR)) || (mUpload && mUpload->HasListenersFor(NS_LITERAL_STRING(PROGRESS_STR)))) { @@ -2966,11 +2964,9 @@ nsXMLHttpRequest::ChangeState(PRUint32 aState, PRBool aBroadcast) mProgressNotifier->Cancel(); } - if ((aState & XML_HTTP_REQUEST_LOADSTATES) && // Broadcast load states only - aBroadcast && - (mState & XML_HTTP_REQUEST_ASYNC || - aState & XML_HTTP_REQUEST_OPENED || - aState & XML_HTTP_REQUEST_COMPLETED)) { + if ((mState & XML_HTTP_REQUEST_ASYNC) && + (aState & XML_HTTP_REQUEST_LOADSTATES) && // Broadcast load states only + aBroadcast) { nsCOMPtr event; rv = CreateReadystatechangeEvent(getter_AddRefs(event)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index c2304dc2822a..51d4419ec772 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -310,8 +310,6 @@ _TEST_FILES = test_bug5141.html \ bug466409-empty.css \ test_bug466409.html \ test_classList.html \ - test_bug313646.html \ - bug313646.txt \ test_bug489925.xhtml \ test_bug514487.html \ $(NULL) diff --git a/content/base/test/bug313646.txt b/content/base/test/bug313646.txt deleted file mode 100644 index 150f5ea6d1de..000000000000 --- a/content/base/test/bug313646.txt +++ /dev/null @@ -1 +0,0 @@ -Nothing to see here. Just need to request this file via XHR. diff --git a/content/base/test/test_bug313646.html b/content/base/test/test_bug313646.html deleted file mode 100644 index 8e9cd4bd44e1..000000000000 --- a/content/base/test/test_bug313646.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Test for Bug 313646 - - - - - -Mozilla Bug 313646 -

- -
-
-
- -