This commit is contained in:
Kyle Huey 2011-08-25 08:19:48 -04:00
Родитель 8f06c9a9a2 916fe0fb9a
Коммит 1b6221fb6c
5 изменённых файлов: 21 добавлений и 25 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 */