Bug 1062529 - Split GetChannelPrincipal into GetChannelResultPrincipal and GetChannelURIPrincipal. r=bz
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Wed, 06 Aug 2014 16:05:40 -0700
changeset 203496 c00ae6dd85ec681b380798d4eed472cc94f93476
parent 203495 cfdcf950e403fc44a02a2e6877e2178027c336f6
child 203497 8a4df73f1ab8c5e927a8f139953bda69f762ef28
push id27428
push usercbook@mozilla.com
push dateThu, 04 Sep 2014 13:00:04 +0000
treeherdermozilla-central@7bfd030e8fc8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1062529
milestone35.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 1062529 - Split GetChannelPrincipal into GetChannelResultPrincipal and GetChannelURIPrincipal. r=bz
caps/nsIScriptSecurityManager.idl
caps/nsScriptSecurityManager.cpp
content/base/src/ImportManager.cpp
content/base/src/nsContentUtils.cpp
content/base/src/nsCrossSiteListenerProxy.cpp
content/base/src/nsDocument.cpp
content/base/src/nsScriptLoader.cpp
content/html/document/src/ImageDocument.cpp
content/media/MediaResource.cpp
content/media/RtspMediaResource.cpp
content/xul/document/src/XULDocument.cpp
docshell/base/nsDocShell.cpp
dom/workers/ScriptLoader.cpp
image/src/ImageFactory.cpp
image/src/imgRequest.cpp
layout/build/nsContentDLF.cpp
layout/style/Loader.cpp
netwerk/base/src/nsChannelClassifier.cpp
netwerk/protocol/http/HttpBaseChannel.cpp
rdf/base/nsRDFXMLDataSource.cpp
--- a/caps/nsIScriptSecurityManager.idl
+++ b/caps/nsIScriptSecurityManager.idl
@@ -14,17 +14,17 @@ interface nsILoadContext;
 
 %{ C++
 #include "jspubtd.h"
 %}
 
 [ptr] native JSContextPtr(JSContext);
 [ptr] native JSObjectPtr(JSObject);
 
-[scriptable, uuid(f6e1e37e-14d0-44fa-a9bb-712bfad6c5f7)]
+[scriptable, uuid(3b021962-975e-43b5-8a93-9fc2d20346e9)]
 interface nsIScriptSecurityManager : nsISupports
 {
     /**
      * For each of these hooks returning NS_OK means 'let the action continue'.
      * Returning an error code means 'veto the action'. XPConnect will return
      * false to the js engine if the action is vetoed. The implementor of this
      * interface is responsible for setting a JS exception into the JSContext
      * if that is appropriate.
@@ -194,17 +194,23 @@ interface nsIScriptSecurityManager : nsI
     void checkSameOriginURI(in nsIURI aSourceURI,
                             in nsIURI aTargetURI,
                             in boolean reportError);
     /**
      * Get the principal for the given channel.  This will typically be the
      * channel owner if there is one, and the codebase principal for the
      * channel's URI otherwise.  aChannel must not be null.
      */
-    nsIPrincipal getChannelPrincipal(in nsIChannel aChannel);
+    nsIPrincipal getChannelResultPrincipal(in nsIChannel aChannel);
+
+    /**
+     * Get the codebase principal for the channel's URI.
+     * aChannel must not be null.
+     */
+    nsIPrincipal getChannelURIPrincipal(in nsIChannel aChannel);
 
     /**
      * Check whether a given principal is a system principal.  This allows us
      * to avoid handing back the system principal to script while allowing
      * script to check whether a given principal is system.
      */
     boolean isSystemPrincipal(in nsIPrincipal aPrincipal);
 %{C++
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -301,18 +301,18 @@ nsScriptSecurityManager::AppStatusForPri
         return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
     }
 
     return status;
 
 }
 
 NS_IMETHODIMP
-nsScriptSecurityManager::GetChannelPrincipal(nsIChannel* aChannel,
-                                             nsIPrincipal** aPrincipal)
+nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
+                                                   nsIPrincipal** aPrincipal)
 {
     NS_PRECONDITION(aChannel, "Must have channel!");
     nsCOMPtr<nsISupports> owner;
     aChannel->GetOwner(getter_AddRefs(owner));
     if (owner) {
         CallQueryInterface(owner, aPrincipal);
         if (*aPrincipal) {
             return NS_OK;
@@ -331,24 +331,31 @@ nsScriptSecurityManager::GetChannelPrinc
             return NS_OK;
         }
 
         if (loadInfo->GetForceInheritPrincipal()) {
             NS_ADDREF(*aPrincipal = loadInfo->LoadingPrincipal());
             return NS_OK;
         }
     }
+    return GetChannelURIPrincipal(aChannel, aPrincipal);
+}
 
-    // OK, get the principal from the URI.  Make sure this does the same thing
+NS_IMETHODIMP
+nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
+                                                nsIPrincipal** aPrincipal)
+{
+    NS_PRECONDITION(aChannel, "Must have channel!");
+
+    // Get the principal from the URI.  Make sure this does the same thing
     // as nsDocument::Reset and XULDocument::StartDocumentLoad.
     nsCOMPtr<nsIURI> uri;
     nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
     NS_ENSURE_SUCCESS(rv, rv);
 
-
     nsCOMPtr<nsILoadContext> loadContext;
     NS_QueryNotificationCallbacks(aChannel, loadContext);
 
     if (loadContext) {
         return GetLoadContextCodebasePrincipal(uri, loadContext, aPrincipal);
     }
 
     return GetCodebasePrincipalInternal(uri, UNKNOWN_APP_ID,
@@ -1184,17 +1191,17 @@ nsScriptSecurityManager::CanGetService(J
 /////////////////////////////////////////////
 NS_IMETHODIMP
 nsScriptSecurityManager::AsyncOnChannelRedirect(nsIChannel* oldChannel, 
                                                 nsIChannel* newChannel,
                                                 uint32_t redirFlags,
                                                 nsIAsyncVerifyRedirectCallback *cb)
 {
     nsCOMPtr<nsIPrincipal> oldPrincipal;
-    GetChannelPrincipal(oldChannel, getter_AddRefs(oldPrincipal));
+    GetChannelResultPrincipal(oldChannel, getter_AddRefs(oldPrincipal));
 
     nsCOMPtr<nsIURI> newURI;
     newChannel->GetURI(getter_AddRefs(newURI));
     nsCOMPtr<nsIURI> newOriginalURI;
     newChannel->GetOriginalURI(getter_AddRefs(newOriginalURI));
 
     NS_ENSURE_STATE(oldPrincipal && newURI && newOriginalURI);
 
--- a/content/base/src/ImportManager.cpp
+++ b/content/base/src/ImportManager.cpp
@@ -338,18 +338,18 @@ ImportLoader::OnStartRequest(nsIRequest*
   nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
   if (!channel) {
     return NS_ERROR_DOM_ABORT_ERR;
   }
 
   if (nsContentUtils::IsSystemPrincipal(principal)) {
     // We should never import non-system documents and run their scripts with system principal!
     nsCOMPtr<nsIPrincipal> channelPrincipal;
-    nsContentUtils::GetSecurityManager()->GetChannelPrincipal(channel,
-                                                              getter_AddRefs(channelPrincipal));
+    nsContentUtils::GetSecurityManager()->GetChannelResultPrincipal(channel,
+                                                                    getter_AddRefs(channelPrincipal));
     if (!nsContentUtils::IsSystemPrincipal(channelPrincipal)) {
       return NS_ERROR_FAILURE;
     }
   }
   channel->SetOwner(principal);
 
   nsAutoCString type;
   channel->GetContentType(type);
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -5665,17 +5665,17 @@ nsContentUtils::GetSameOriginChecker()
 nsresult
 nsContentUtils::CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel)
 {
   if (!nsContentUtils::GetSecurityManager())
     return NS_ERROR_NOT_AVAILABLE;
 
   nsCOMPtr<nsIPrincipal> oldPrincipal;
   nsContentUtils::GetSecurityManager()->
-    GetChannelPrincipal(aOldChannel, getter_AddRefs(oldPrincipal));
+    GetChannelResultPrincipal(aOldChannel, getter_AddRefs(oldPrincipal));
 
   nsCOMPtr<nsIURI> newURI;
   aNewChannel->GetURI(getter_AddRefs(newURI));
   nsCOMPtr<nsIURI> newOriginalURI;
   aNewChannel->GetOriginalURI(getter_AddRefs(newOriginalURI));
 
   NS_ENSURE_STATE(oldPrincipal && newURI && newOriginalURI);
 
--- a/content/base/src/nsCrossSiteListenerProxy.cpp
+++ b/content/base/src/nsCrossSiteListenerProxy.cpp
@@ -677,23 +677,25 @@ nsCORSListenerProxy::AsyncOnChannelRedir
         }
       }
       aOldChannel->Cancel(NS_ERROR_DOM_BAD_URI);
       return NS_ERROR_DOM_BAD_URI;
     }
 
     if (mHasBeenCrossSite) {
       // Once we've been cross-site, cross-origin redirects reset our source
-      // origin.
+      // origin. Note that we need to call GetChannelURIPrincipal() because
+      // we are looking for the principal that is actually being loaded and not
+      // the principal that initiated the load.
       nsCOMPtr<nsIPrincipal> oldChannelPrincipal;
       nsContentUtils::GetSecurityManager()->
-        GetChannelPrincipal(aOldChannel, getter_AddRefs(oldChannelPrincipal));
+        GetChannelURIPrincipal(aOldChannel, getter_AddRefs(oldChannelPrincipal));
       nsCOMPtr<nsIPrincipal> newChannelPrincipal;
       nsContentUtils::GetSecurityManager()->
-        GetChannelPrincipal(aNewChannel, getter_AddRefs(newChannelPrincipal));
+        GetChannelURIPrincipal(aNewChannel, getter_AddRefs(newChannelPrincipal));
       if (!oldChannelPrincipal || !newChannelPrincipal) {
         rv = NS_ERROR_OUT_OF_MEMORY;
       }
 
       if (NS_SUCCEEDED(rv)) {
         bool equal;
         rv = oldChannelPrincipal->Equals(newChannelPrincipal, &equal);
         if (NS_SUCCEEDED(rv)) {
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -2203,25 +2203,25 @@ nsIDocument::IsVisibleConsideringAncesto
 
 void
 nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
 {
   nsCOMPtr<nsIURI> uri;
   nsCOMPtr<nsIPrincipal> principal;
   if (aChannel) {
     // Note: this code is duplicated in XULDocument::StartDocumentLoad and
-    // nsScriptSecurityManager::GetChannelPrincipal.
+    // nsScriptSecurityManager::GetChannelResultPrincipal.
     // Note: this should match nsDocShell::OnLoadingSite
     NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
 
     nsIScriptSecurityManager *securityManager =
       nsContentUtils::GetSecurityManager();
     if (securityManager) {
-      securityManager->GetChannelPrincipal(aChannel,
-                                           getter_AddRefs(principal));
+      securityManager->GetChannelResultPrincipal(aChannel,
+                                                 getter_AddRefs(principal));
     }
   }
 
   ResetToURI(uri, aLoadGroup, principal);
 
   nsCOMPtr<nsIPropertyBag2> bag = do_QueryInterface(aChannel);
   if (bag) {
     nsCOMPtr<nsIURI> baseURI;
--- a/content/base/src/nsScriptLoader.cpp
+++ b/content/base/src/nsScriptLoader.cpp
@@ -1456,17 +1456,17 @@ nsScriptLoader::PrepareLoadedRequest(nsS
   }
 
   nsCOMPtr<nsIChannel> channel = do_QueryInterface(req);
   // If this load was subject to a CORS check; don't flag it with a
   // separate origin principal, so that it will treat our document's
   // principal as the origin principal
   if (aRequest->mCORSMode == CORS_NONE) {
     rv = nsContentUtils::GetSecurityManager()->
-      GetChannelPrincipal(channel, getter_AddRefs(aRequest->mOriginPrincipal));
+      GetChannelResultPrincipal(channel, getter_AddRefs(aRequest->mOriginPrincipal));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (aStringLen) {
     // Check the charset attribute to determine script charset.
     nsAutoString hintCharset;
     if (!aRequest->IsPreload()) {
       aRequest->mElement->GetScriptCharset(hintCharset);
--- a/content/html/document/src/ImageDocument.cpp
+++ b/content/html/document/src/ImageDocument.cpp
@@ -89,17 +89,17 @@ ImageListener::OnStartRequest(nsIRequest
   channel->GetURI(getter_AddRefs(channelURI));
 
   nsAutoCString mimeType;
   channel->GetContentType(mimeType);
 
   nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
   nsCOMPtr<nsIPrincipal> channelPrincipal;
   if (secMan) {
-    secMan->GetChannelPrincipal(channel, getter_AddRefs(channelPrincipal));
+    secMan->GetChannelResultPrincipal(channel, getter_AddRefs(channelPrincipal));
   }
 
   int16_t decision = nsIContentPolicy::ACCEPT;
   nsresult rv = NS_CheckContentProcessPolicy(nsIContentPolicy::TYPE_IMAGE,
                                              channelURI,
                                              channelPrincipal,
                                              domWindow->GetFrameElementInternal(),
                                              mimeType,
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -529,17 +529,17 @@ ChannelMediaResource::OnDataAvailable(ns
   {
     MutexAutoLock lock(mLock);
     mChannelStatistics->AddBytes(aCount);
   }
 
   CopySegmentClosure closure;
   nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
   if (secMan && mChannel) {
-    secMan->GetChannelPrincipal(mChannel, getter_AddRefs(closure.mPrincipal));
+    secMan->GetChannelResultPrincipal(mChannel, getter_AddRefs(closure.mPrincipal));
   }
   closure.mResource = this;
 
   uint32_t count = aCount;
   while (count > 0) {
     uint32_t read;
     nsresult rv = aStream->ReadSegments(CopySegmentToCache, &closure, count,
                                         &read);
@@ -1401,17 +1401,17 @@ nsresult FileMediaResource::Close()
 already_AddRefed<nsIPrincipal> FileMediaResource::GetCurrentPrincipal()
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
   nsCOMPtr<nsIPrincipal> principal;
   nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
   if (!secMan || !mChannel)
     return nullptr;
-  secMan->GetChannelPrincipal(mChannel, getter_AddRefs(principal));
+  secMan->GetChannelResultPrincipal(mChannel, getter_AddRefs(principal));
   return principal.forget();
 }
 
 bool FileMediaResource::CanClone()
 {
   return true;
 }
 
--- a/content/media/RtspMediaResource.cpp
+++ b/content/media/RtspMediaResource.cpp
@@ -735,17 +735,17 @@ nsresult RtspMediaResource::Close()
 already_AddRefed<nsIPrincipal> RtspMediaResource::GetCurrentPrincipal()
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
   nsCOMPtr<nsIPrincipal> principal;
   nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
   if (!secMan || !mChannel)
     return nullptr;
-  secMan->GetChannelPrincipal(mChannel, getter_AddRefs(principal));
+  secMan->GetChannelResultPrincipal(mChannel, getter_AddRefs(principal));
   return principal.forget();
 }
 
 nsresult RtspMediaResource::SeekTime(int64_t aOffset)
 {
   NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
 
   RTSPMLOG("Seek requested for aOffset [%lld] for decoder [%p]",
--- a/content/xul/document/src/XULDocument.cpp
+++ b/content/xul/document/src/XULDocument.cpp
@@ -1999,17 +1999,17 @@ XULDocument::PrepareToLoad(nsISupports* 
                            const char* aCommand,
                            nsIChannel* aChannel,
                            nsILoadGroup* aLoadGroup,
                            nsIParser** aResult)
 {
     // Get the document's principal
     nsCOMPtr<nsIPrincipal> principal;
     nsContentUtils::GetSecurityManager()->
-        GetChannelPrincipal(aChannel, getter_AddRefs(principal));
+        GetChannelResultPrincipal(aChannel, getter_AddRefs(principal));
     return PrepareToLoadPrototype(mDocumentURI, aCommand, principal, aResult);
 }
 
 
 nsresult
 XULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand,
                                     nsIPrincipal* aDocumentPrincipal,
                                     nsIParser** aResult)
@@ -4511,17 +4511,17 @@ XULDocument::ParserObserver::OnStartRequ
                                             nsISupports* aContext)
 {
     // Guard against buggy channels calling OnStartRequest multiple times.
     if (mPrototype) {
         nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
         nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
         if (channel && secMan) {
             nsCOMPtr<nsIPrincipal> principal;
-            secMan->GetChannelPrincipal(channel, getter_AddRefs(principal));
+            secMan->GetChannelResultPrincipal(channel, getter_AddRefs(principal));
 
             // Failure there is ok -- it'll just set a (safe) null principal
             mPrototype->SetDocumentPrincipal(principal);
         }
 
         // Make sure to avoid cycles
         mPrototype = nullptr;
     }
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -6575,17 +6575,17 @@ NS_IMETHODIMP nsDocShell::SetupRefreshUR
                                             refreshHeader);
 
         if (!refreshHeader.IsEmpty()) {
             nsCOMPtr<nsIScriptSecurityManager> secMan =
                 do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
             NS_ENSURE_SUCCESS(rv, rv);
 
             nsCOMPtr<nsIPrincipal> principal;
-            rv = secMan->GetChannelPrincipal(aChannel, getter_AddRefs(principal));
+            rv = secMan->GetChannelResultPrincipal(aChannel, getter_AddRefs(principal));
             NS_ENSURE_SUCCESS(rv, rv);
 
             SetupReferrerFromChannel(aChannel);
             rv = SetupRefreshURIFromHeader(mCurrentURI, principal, refreshHeader);
             if (NS_SUCCEEDED(rv)) {
                 return NS_REFRESHURI_HEADER_FOUND;
             }
         }
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -497,17 +497,17 @@ private:
       nsCOMPtr<nsIPrincipal> loadPrincipal = mWorkerPrivate->GetPrincipal() ?
                                              mWorkerPrivate->GetPrincipal() :
                                              parent->GetPrincipal();
 
       nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
       NS_ASSERTION(ssm, "Should never be null!");
 
       nsCOMPtr<nsIPrincipal> channelPrincipal;
-      rv = ssm->GetChannelPrincipal(channel, getter_AddRefs(channelPrincipal));
+      rv = ssm->GetChannelResultPrincipal(channel, getter_AddRefs(channelPrincipal));
       NS_ENSURE_SUCCESS(rv, rv);
 
       // See if this is a resource URI. Since JSMs usually come from resource://
       // URIs we're currently considering all URIs with the URI_IS_UI_RESOURCE
       // flag as valid for creating privileged workers.
       if (!nsContentUtils::IsSystemPrincipal(channelPrincipal)) {
         bool isResource;
         rv = NS_URIChainHasFlags(finalURI,
--- a/image/src/ImageFactory.cpp
+++ b/image/src/ImageFactory.cpp
@@ -241,18 +241,18 @@ ImageFactory::CreateRasterImage(nsIReque
     newImage->SetRequestedResolution(parser.GetResolution());
   }
 
   if (parser.HasSampleSize()) {
       /* Get our principal */
       nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
       nsCOMPtr<nsIPrincipal> principal;
       if (chan) {
-        nsContentUtils::GetSecurityManager()->GetChannelPrincipal(chan,
-                                                                  getter_AddRefs(principal));
+        nsContentUtils::GetSecurityManager()->GetChannelResultPrincipal(chan,
+                                                                        getter_AddRefs(principal));
       }
 
       if ((principal &&
            principal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED) ||
           gEnableMozSampleSize) {
         newImage->SetRequestedSampleSize(parser.GetSampleSize());
       }
   }
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -647,18 +647,18 @@ NS_IMETHODIMP imgRequest::OnStartRequest
   if (channel)
     channel->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
 
   /* Get our principal */
   nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
   if (chan) {
     nsCOMPtr<nsIScriptSecurityManager> secMan = nsContentUtils::GetSecurityManager();
     if (secMan) {
-      nsresult rv = secMan->GetChannelPrincipal(chan,
-                                                getter_AddRefs(mPrincipal));
+      nsresult rv = secMan->GetChannelResultPrincipal(chan,
+                                                      getter_AddRefs(mPrincipal));
       if (NS_FAILED(rv)) {
         return rv;
       }
     }
   }
 
   SetCacheValidation(mCacheEntry, aRequest);
 
--- a/layout/build/nsContentDLF.cpp
+++ b/layout/build/nsContentDLF.cpp
@@ -118,17 +118,17 @@ MayUseXULXBL(nsIChannel* aChannel)
 {
   nsIScriptSecurityManager *securityManager =
     nsContentUtils::GetSecurityManager();
   if (!securityManager) {
     return false;
   }
 
   nsCOMPtr<nsIPrincipal> principal;
-  securityManager->GetChannelPrincipal(aChannel, getter_AddRefs(principal));
+  securityManager->GetChannelResultPrincipal(aChannel, getter_AddRefs(principal));
   NS_ENSURE_TRUE(principal, false);
 
   return nsContentUtils::AllowXULXBLForPrincipal(principal);
 }
 
 NS_IMETHODIMP
 nsContentDLF::CreateInstance(const char* aCommand,
                              nsIChannel* aChannel,
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -856,17 +856,17 @@ SheetLoadData::OnStreamComplete(nsIUnich
 
   nsCOMPtr<nsIPrincipal> principal;
   nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
   result = NS_ERROR_NOT_AVAILABLE;
   if (secMan) {  // Could be null if we already shut down
     if (mUseSystemPrincipal) {
       result = secMan->GetSystemPrincipal(getter_AddRefs(principal));
     } else {
-      result = secMan->GetChannelPrincipal(channel, getter_AddRefs(principal));
+      result = secMan->GetChannelResultPrincipal(channel, getter_AddRefs(principal));
     }
   }
 
   if (NS_FAILED(result)) {
     LOG_WARN(("  Couldn't get principal"));
     mLoader->SheetComplete(this, result);
     return NS_OK;
   }
--- a/netwerk/base/src/nsChannelClassifier.cpp
+++ b/netwerk/base/src/nsChannelClassifier.cpp
@@ -221,18 +221,18 @@ nsChannelClassifier::Start(nsIChannel *a
     }
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIScriptSecurityManager> securityManager =
         do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIPrincipal> principal;
-    rv = securityManager->GetChannelPrincipal(aChannel,
-                                              getter_AddRefs(principal));
+    rv = securityManager->GetChannelResultPrincipal(aChannel,
+                                                    getter_AddRefs(principal));
     NS_ENSURE_SUCCESS(rv, rv);
 
     bool expectCallback;
     bool trackingProtectionEnabled = false;
     (void)ShouldEnableTrackingProtection(aChannel, &trackingProtectionEnabled);
 
     rv = uriClassifier->Classify(principal, trackingProtectionEnabled, this,
                                  &expectCallback);
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1731,17 +1731,17 @@ HttpBaseChannel::GetPrincipal(bool requi
       nsContentUtils::GetSecurityManager();
 
   if (!securityManager) {
       LOG(("HttpBaseChannel::GetPrincipal: No security manager [this=%p]",
            this));
       return nullptr;
   }
 
-  securityManager->GetChannelPrincipal(this, getter_AddRefs(mPrincipal));
+  securityManager->GetChannelResultPrincipal(this, getter_AddRefs(mPrincipal));
   if (!mPrincipal) {
       LOG(("HttpBaseChannel::GetPrincipal: No channel principal [this=%p]",
            this));
       return nullptr;
   }
 
   // principals with unknown app ids do not work with the permission manager
   if (requireAppId && mPrincipal->GetUnknownAppId()) {
--- a/rdf/base/nsRDFXMLDataSource.cpp
+++ b/rdf/base/nsRDFXMLDataSource.cpp
@@ -877,17 +877,17 @@ RDFXMLDataSourceImpl::AsyncOnChannelRedi
     NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
 
     nsresult rv;
     nsCOMPtr<nsIScriptSecurityManager> secMan =
         do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIPrincipal> oldPrincipal;
-    secMan->GetChannelPrincipal(aOldChannel, getter_AddRefs(oldPrincipal));
+    secMan->GetChannelResultPrincipal(aOldChannel, getter_AddRefs(oldPrincipal));
 
     nsCOMPtr<nsIURI> newURI;
     aNewChannel->GetURI(getter_AddRefs(newURI));
     nsCOMPtr<nsIURI> newOriginalURI;
     aNewChannel->GetOriginalURI(getter_AddRefs(newOriginalURI));
 
     NS_ENSURE_STATE(oldPrincipal && newURI && newOriginalURI);