Bug 1277496 - use nsHttp::Origin instead of literal cstring r=francois
authorJunior Hsu <juhsu@mozilla.com>
Mon, 05 Nov 2018 21:40:36 +0000
changeset 444515 1b9757b74504927b9169ca1796d016e69a9be835
parent 444514 ca90391329b7c7f7481ae3b98f9082356af88ba4
child 444516 0874b793fc046bf31ca80c673d5dfa0bb38ea343
push id34996
push userrgurzau@mozilla.com
push dateTue, 06 Nov 2018 09:53:23 +0000
treeherdermozilla-central@e160f0a60e4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois
bugs1277496
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1277496 - use nsHttp::Origin instead of literal cstring r=francois Differential Revision: https://phabricator.services.mozilla.com/D10752
dom/fetch/FetchDriver.cpp
netwerk/protocol/http/nsCORSListenerProxy.cpp
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -1476,17 +1476,17 @@ FetchDriver::SetRequestHeaders(nsIHttpCh
                                  false /* merge */);
     MOZ_ASSERT(NS_SUCCEEDED(rv));
   }
 
   if (mRequest->ForceOriginHeader()) {
     nsAutoString origin;
     if (NS_SUCCEEDED(nsContentUtils::GetUTFOrigin(mPrincipal, origin))) {
       DebugOnly<nsresult> rv =
-        aChannel->SetRequestHeader(NS_LITERAL_CSTRING("origin"),
+        aChannel->SetRequestHeader(nsDependentCString(net::nsHttp::Origin),
                                    NS_ConvertUTF16toUTF8(origin),
                                    false /* merge */);
       MOZ_ASSERT(NS_SUCCEEDED(rv));
     }
   }
 }
 
 void
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -1008,17 +1008,17 @@ nsCORSListenerProxy::UpdateChannel(nsICh
   // Add the Origin header
   nsAutoCString origin;
   rv = nsContentUtils::GetASCIIOrigin(mOriginHeaderPrincipal, origin);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(aChannel);
   NS_ENSURE_TRUE(http, NS_ERROR_FAILURE);
 
-  rv = http->SetRequestHeader(NS_LITERAL_CSTRING("Origin"), origin, false);
+  rv = http->SetRequestHeader(nsDependentCString(net::nsHttp::Origin), origin, false);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Make cookie-less if needed. We don't need to do anything here if the
   // channel was opened with AsyncOpen2, since then AsyncOpen2 will take
   // care of the cookie policy for us.
   if (!mWithCredentials &&
       (!loadInfo || !loadInfo->GetEnforceSecurity())) {
     nsLoadFlags flags;