Bug 1087646 - fast-path null principal'd documents. r=mcmanus
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 24 Feb 2015 12:54:40 -0800
changeset 230590 9f4da60dbfff7e506b2649011a755cff0a5ca7a0
parent 230589 fa5a5dbde1c792e759791640bae2936b8555a652
child 230591 bc2be5c8ab2abc19df3617ac4e3d2395997aebeb
push id28332
push usercbook@mozilla.com
push dateWed, 25 Feb 2015 11:06:35 +0000
treeherdermozilla-central@6608e0605dfc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1087646
milestone39.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 1087646 - fast-path null principal'd documents. r=mcmanus
netwerk/cookie/CookieServiceChild.cpp
--- a/netwerk/cookie/CookieServiceChild.cpp
+++ b/netwerk/cookie/CookieServiceChild.cpp
@@ -104,16 +104,23 @@ CookieServiceChild::GetCookieStringInter
                                             char **aCookieString,
                                             bool aFromHttp)
 {
   NS_ENSURE_ARG(aHostURI);
   NS_ENSURE_ARG_POINTER(aCookieString);
 
   *aCookieString = nullptr;
 
+  // Fast past: don't bother sending IPC messages about nullprincipal'd
+  // documents.
+  nsAutoCString scheme;
+  aHostURI->GetScheme(scheme);
+  if (scheme.EqualsLiteral("moz-nullprincipal"))
+    return NS_OK;
+
   // Determine whether the request is foreign. Failure is acceptable.
   bool isForeign = true;
   if (RequireThirdPartyCheck())
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
 
   URIParams uriParams;
   SerializeURI(aHostURI, uriParams);
 
@@ -132,16 +139,23 @@ CookieServiceChild::SetCookieStringInter
                                             nsIChannel *aChannel,
                                             const char *aCookieString,
                                             const char *aServerTime,
                                             bool aFromHttp)
 {
   NS_ENSURE_ARG(aHostURI);
   NS_ENSURE_ARG_POINTER(aCookieString);
 
+  // Fast past: don't bother sending IPC messages about nullprincipal'd
+  // documents.
+  nsAutoCString scheme;
+  aHostURI->GetScheme(scheme);
+  if (scheme.EqualsLiteral("moz-nullprincipal"))
+    return NS_OK;
+
   // Determine whether the request is foreign. Failure is acceptable.
   bool isForeign = true;
   if (RequireThirdPartyCheck())
     mThirdPartyUtil->IsThirdPartyChannel(aChannel, aHostURI, &isForeign);
 
   nsDependentCString cookieString(aCookieString);
   nsDependentCString serverTime;
   if (aServerTime)