diff --git a/configure.in b/configure.in index 7138f764131..d3e93810a83 100644 --- a/configure.in +++ b/configure.in @@ -4797,9 +4797,7 @@ MOZ_ARG_ENABLE_STRING(application, xulrunner content/xslt (Standalone Transformiix XSLT) netwerk (Standalone Necko) - tools/update-packaging (AUS-related packaging tools) - standalone (use this for standalone - xpcom/xpconnect or to manually drive a build)], + tools/update-packaging (AUS-related packaging tools)], [ MOZ_BUILD_APP=$enableval ] ) MOZ_ARG_WITH_STRING(xulrunner-stub-name, @@ -4877,12 +4875,6 @@ content/xslt) AC_DEFINE(TX_EXE) ;; -standalone) - MOZ_APP_NAME=mozilla - MOZ_APP_DISPLAYNAME=Mozilla - MOZ_APP_VERSION=$MOZILLA_VERSION - ;; - esac AC_SUBST(MOZ_BUILD_APP) diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index dc6c724fedd..b72e5d3f69f 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -1230,23 +1230,20 @@ nsXMLHttpRequest::GetResponseHeader(const nsACString& header, return rv; } -nsresult -nsXMLHttpRequest::GetLoadGroup(nsILoadGroup **aLoadGroup) +already_AddRefed<nsILoadGroup> +nsXMLHttpRequest::GetLoadGroup() const { - NS_ENSURE_ARG_POINTER(aLoadGroup); - *aLoadGroup = nsnull; - if (mState & XML_HTTP_REQUEST_BACKGROUND) { - return NS_OK; + return nsnull; } nsCOMPtr<nsIDocument> doc = nsContentUtils::GetDocumentFromScriptContext(mScriptContext); if (doc) { - *aLoadGroup = doc->GetDocumentLoadGroup().get(); // already_AddRefed + return doc->GetDocumentLoadGroup(); } - return NS_OK; + return nsnull; } nsresult @@ -1493,8 +1490,7 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url, // When we are called from JS we can find the load group for the page, // and add ourselves to it. This way any pending requests // will be automatically aborted if the user leaves the page. - nsCOMPtr<nsILoadGroup> loadGroup; - GetLoadGroup(getter_AddRefs(loadGroup)); + nsCOMPtr<nsILoadGroup> loadGroup = GetLoadGroup(); // get Content Security Policy from principal to pass into channel nsCOMPtr<nsIChannelPolicy> channelPolicy; @@ -1728,6 +1724,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt) mResponseBody.Truncate(); mResponseBodyUnicode.SetIsVoid(PR_TRUE); mResponseBlob = nsnull; + mResultArrayBuffer = nsnull; // Set up responseXML PRBool parseBody = mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT || @@ -2075,7 +2072,7 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult, // nsIInputStream? nsCOMPtr<nsIInputStream> stream = do_QueryInterface(supports); if (stream) { - *aResult = stream.forget().get(); + stream.forget(aResult); aCharset.Truncate(); return NS_OK; diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index a08f6da2dd4..1bef072d90e 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -214,7 +214,7 @@ protected: // Change the state of the object with this. The broadcast argument // determines if the onreadystatechange listener should be called. nsresult ChangeState(PRUint32 aState, PRBool aBroadcast = PR_TRUE); - nsresult GetLoadGroup(nsILoadGroup **aLoadGroup); + already_AddRefed<nsILoadGroup> GetLoadGroup() const; nsIURI *GetBaseURI(); nsresult RemoveAddEventListener(const nsAString& aType, diff --git a/content/base/test/test_XHR.html b/content/base/test/test_XHR.html index 8243bb704bd..b750f871546 100644 --- a/content/base/test/test_XHR.html +++ b/content/base/test/test_XHR.html @@ -121,6 +121,17 @@ ab = xhr.response; ok(ab != null, "should have a non-null arraybuffer"); arraybuffer_equals_to(ab, "hello pass\n"); +// test reusing the same XHR (Bug 680816) +xhr.open("GET", 'file_XHR_binary1.bin', false); +xhr.responseType = 'arraybuffer'; +xhr.send(null); +is(xhr.status, 200, "wrong status"); +ab2 = xhr.response; +ok(ab2 != null, "should have a non-null arraybuffer"); +ok(ab2 != ab, "arraybuffer on XHR reuse should be distinct"); +arraybuffer_equals_to(ab, "hello pass\n"); +arraybuffer_equals_to(ab2, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb"); + // with a binary file xhr = new XMLHttpRequest(); xhr.open("GET", 'file_XHR_binary1.bin', false); diff --git a/js/src/xpconnect/loader/mozJSLoaderUtils.cpp b/js/src/xpconnect/loader/mozJSLoaderUtils.cpp index 0f77b8786f2..b42111a08e3 100644 --- a/js/src/xpconnect/loader/mozJSLoaderUtils.cpp +++ b/js/src/xpconnect/loader/mozJSLoaderUtils.cpp @@ -35,8 +35,6 @@ * * ***** END LICENSE BLOCK ***** */ -#if !defined(XPCONNECT_STANDALONE) - #include "nsAutoPtr.h" #include "nsScriptLoader.h" @@ -191,5 +189,3 @@ WriteCachedScript(StartupCache* cache, nsACString &uri, JSContext *cx, JSObject rv = cache->PutBuffer(PromiseFlatCString(uri).get(), buf, len); return rv; } - -#endif /* XPCONNECT_STANDALONE */