From bdb6e36dd644dbf497024f1af2066a8787c5028e Mon Sep 17 00:00:00 2001 From: "bzbarsky@mit.edu" Date: Thu, 15 Nov 2007 14:18:36 -0800 Subject: [PATCH] When calling open() on an in-progress XMLHttpRequest, abort the request but still allow the open() to reinitialize it. Bug 322317, r+sr=sicking, a=vlad --- content/base/src/nsXMLHttpRequest.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 27a7eb8c6ff8..45a62e570e8c 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -1227,18 +1227,11 @@ nsXMLHttpRequest::OpenRequest(const nsACString& method, nsCOMPtr uri; PRBool authp = PR_FALSE; - if (mState & XML_HTTP_REQUEST_ABORTED) { - // Something caused this request to abort (e.g the current request - // was caceled, channels closed etc), most likely the abort() - // function was called by script. Unset our aborted state, and - // proceed as normal - - mState &= ~XML_HTTP_REQUEST_ABORTED; - } else if (mState & (XML_HTTP_REQUEST_OPENED | - XML_HTTP_REQUEST_LOADED | - XML_HTTP_REQUEST_INTERACTIVE | - XML_HTTP_REQUEST_SENT | - XML_HTTP_REQUEST_STOPPED)) { + if (mState & (XML_HTTP_REQUEST_OPENED | + XML_HTTP_REQUEST_LOADED | + XML_HTTP_REQUEST_INTERACTIVE | + XML_HTTP_REQUEST_SENT | + XML_HTTP_REQUEST_STOPPED)) { // IE aborts as well Abort(); @@ -1247,8 +1240,15 @@ nsXMLHttpRequest::OpenRequest(const nsACString& method, // 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. + } - return NS_OK; + if (mState & XML_HTTP_REQUEST_ABORTED) { + // Something caused this request to abort (e.g the current request + // was caceled, channels closed etc), most likely the abort() + // function was called by script. Unset our aborted state, and + // proceed as normal + + mState &= ~XML_HTTP_REQUEST_ABORTED; } if (async) {