Bug 421622 - nsXMLHttpRequest#send() shouldn't reset all request headers when called from chrome. Patch by Manish Singh <manish@flock.com> r/sr=sicking, a1.9=beltzner
authormattwillis@gmail.com
Thu, 13 Mar 2008 04:43:06 -0700
changeset 13005 49ffa46f4cc98fc75ab5ee0a7639a56f7ec9fd11
parent 13004 4d50540a4808016007261e093c98a8fd07480088
child 13006 9d654e6a00086e093ca780c2cfd900ff08911dca
push idunknown
push userunknown
push dateunknown
bugs421622
milestone1.9b5pre
Bug 421622 - nsXMLHttpRequest#send() shouldn't reset all request headers when called from chrome. Patch by Manish Singh <manish@flock.com> r/sr=sicking, a1.9=beltzner
content/base/src/nsXMLHttpRequest.cpp
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -2088,20 +2088,22 @@ nsXMLHttpRequest::Send(nsIVariant *aBody
   // Ignore argument if method is GET, there is no point in trying to
   // upload anything
   nsCAutoString method;
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
 
   if (httpChannel) {
     httpChannel->GetRequestMethod(method); // If GET, method name will be uppercase
 
-    nsCOMPtr<nsIURI> codebase;
-    mPrincipal->GetURI(getter_AddRefs(codebase));
-
-    httpChannel->SetReferrer(codebase);
+    if (!IsSystemPrincipal(mPrincipal)) {
+      nsCOMPtr<nsIURI> codebase;
+      mPrincipal->GetURI(getter_AddRefs(codebase));
+
+      httpChannel->SetReferrer(codebase);
+    }
   }
 
   if (aBody && httpChannel && !method.EqualsLiteral("GET")) {
     nsXPIDLString serial;
     nsCOMPtr<nsIInputStream> postDataStream;
     nsCAutoString charset(NS_LITERAL_CSTRING("UTF-8"));
 
     PRUint16 dataType;