Merge b-s to m-c.
authorKyle Huey <khuey@kylehuey.com>
Thu, 25 Aug 2011 08:19:48 -0400
changeset 75877 e136897709967e43e35ce4678db19a6204ee94ec
parent 75872 f6b61dde6a159dc3d5ea30c387b6c95687d35400 (current diff)
parent 75876 443d9a9d3c67bfe5b7845736c77af3789e2814e4 (diff)
child 75887 d0700ba932b46a8ea169cdf6423d31667319ff9f
child 75982 20e301ec28a0569379c03f42bfeb375a2638a014
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
milestone9.0a1
Merge b-s to m-c.
configure.in
--- a/configure.in
+++ b/configure.in
@@ -4792,19 +4792,17 @@ esac
 
 MOZ_ARG_ENABLE_STRING(application,
 [  --enable-application=APP
                           Options include:
                             browser (Firefox)
                             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,
 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
   XULRUNNER_STUB_NAME=$withval)
 
 if test -z "$XULRUNNER_STUB_NAME"; then
   case "$target_os" in
@@ -4872,22 +4870,16 @@ browser)
 xulrunner)
   AC_DEFINE(MOZ_XULRUNNER)
   ;;
 
 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)
 AC_SUBST(MOZ_PHOENIX)
 AC_SUBST(MOZ_XULRUNNER)
 
 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
 
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -1225,33 +1225,30 @@ nsXMLHttpRequest::GetResponseHeader(cons
     // Means no header
     _retval.SetIsVoid(PR_TRUE);
     rv = NS_OK;
   }
 
   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
 nsXMLHttpRequest::CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent)
 {
   nsresult rv = nsEventDispatcher::CreateEvent(nsnull, nsnull,
                                                NS_LITERAL_STRING("Events"),
                                                aDOMEvent);
@@ -1488,18 +1485,17 @@ nsXMLHttpRequest::Open(const nsACString&
     }
     uri->SetUserPass(userpass);
     authp = PR_TRUE;
   }
 
   // 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;
   nsCOMPtr<nsIContentSecurityPolicy> csp;
   rv = mPrincipal->GetCsp(getter_AddRefs(csp));
   NS_ENSURE_SUCCESS(rv, rv);
   if (csp) {
     channelPolicy = do_CreateInstance("@mozilla.org/nschannelpolicy;1");
@@ -1723,16 +1719,17 @@ nsXMLHttpRequest::OnStartRequest(nsIRequ
     DispatchProgressEvent(mUpload, NS_LITERAL_STRING(LOAD_STR),
                           PR_TRUE, mUploadTotal, mUploadTotal);
   }
 
   // Reset responseBody
   mResponseBody.Truncate();
   mResponseBodyUnicode.SetIsVoid(PR_TRUE);
   mResponseBlob = nsnull;
+  mResultArrayBuffer = nsnull;
 
   // Set up responseXML
   PRBool parseBody = mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||
                      mResponseType == XML_HTTP_RESPONSE_TYPE_DOCUMENT;
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
   if (parseBody && httpChannel) {
     nsCAutoString method;
     httpChannel->GetRequestMethod(method);
@@ -2070,17 +2067,17 @@ GetRequestBody(nsIVariant* aBody, nsIInp
 
       return NS_NewCStringInputStream(aResult,
                                       NS_ConvertUTF16toUTF8(string));
     }
 
     // nsIInputStream?
     nsCOMPtr<nsIInputStream> stream = do_QueryInterface(supports);
     if (stream) {
-      *aResult = stream.forget().get();
+      stream.forget(aResult);
       aCharset.Truncate();
 
       return NS_OK;
     }
 
     // nsIXHRSendable?
     nsCOMPtr<nsIXHRSendable> sendable = do_QueryInterface(supports);
     if (sendable) {
--- a/content/base/src/nsXMLHttpRequest.h
+++ b/content/base/src/nsXMLHttpRequest.h
@@ -209,17 +209,17 @@ protected:
                 PRUint32 toOffset,
                 PRUint32 count,
                 PRUint32 *writeCount);
   nsresult CreateResponseArrayBuffer(JSContext* aCx);
   void CreateResponseBlob(nsIRequest *request);
   // 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,
                                   nsRefPtr<nsDOMEventListenerWrapper>& aCurrent,
                                   nsIDOMEventListener* aNew);
 
   nsresult GetInnerEventListener(nsRefPtr<nsDOMEventListenerWrapper>& aWrapper,
                                  nsIDOMEventListener** aListener);
--- a/content/base/test/test_XHR.html
+++ b/content/base/test/test_XHR.html
@@ -116,16 +116,27 @@ xhr.responseType = 'arraybuffer';
 xhr.send(null);
 is(xhr.status, 200, "wrong status");
 checkResponseTextAccessThrows(xhr);
 checkResponseXMLAccessThrows(xhr);
 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); 
 xhr.responseType = 'arraybuffer';
 xhr.send(null)
 is(xhr.status, 200, "wrong status");
 checkResponseTextAccessThrows(xhr);
 checkResponseXMLAccessThrows(xhr);
--- a/js/src/xpconnect/loader/mozJSLoaderUtils.cpp
+++ b/js/src/xpconnect/loader/mozJSLoaderUtils.cpp
@@ -30,18 +30,16 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#if !defined(XPCONNECT_STANDALONE)
-
 #include "nsAutoPtr.h"
 #include "nsScriptLoader.h"
 
 #include "jsapi.h"
 #include "jsxdrapi.h"
 
 #include "mozilla/scache/StartupCache.h"
 #include "mozilla/scache/StartupCacheUtils.h"
@@ -186,10 +184,8 @@ WriteCachedScript(StartupCache* cache, n
     nsAutoArrayPtr<char> buf;
     PRUint32 len;
     rv = NewBufferFromStorageStream(storageStream, getter_Transfers(buf), &len);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = cache->PutBuffer(PromiseFlatCString(uri).get(), buf, len);
     return rv;
 }
-
-#endif /* XPCONNECT_STANDALONE */