Commit 97872f2f authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1627707 - Rename LoadInfo::LoadingPrincipal to GetLoadingPrincipal as it...

Bug 1627707 - Rename LoadInfo::LoadingPrincipal to GetLoadingPrincipal as it can return null. r=ckerschb

Mostly a matter of:

  rg -l '\->LoadingPrincipal' | xargs sed -i 's/->LoadingPrincipal/->GetLoadingPrincipal/g'

And then clang-format. But I tweaked manually nsHttpChannelAuthProvider (move
the variable where it's used, don't take a useless strong ref),
AddonContentPolicy (move the declaration of the variable to the if condition),
and BackgroundUtils (same).

Differential Revision: https://phabricator.services.mozilla.com/D69828

--HG--
extra : moz-landing-system : lando
parent 8b1032cd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -11061,9 +11061,9 @@ nsresult nsDocShell::AddToSessionHistory(
    // For now keep storing just the principal in the SHEntry.
    if (!principalToInherit) {
      if (loadInfo->GetLoadingSandboxed()) {
        if (loadInfo->LoadingPrincipal()) {
        if (loadInfo->GetLoadingPrincipal()) {
          principalToInherit = NullPrincipal::CreateWithInheritedAttributes(
              loadInfo->LoadingPrincipal());
              loadInfo->GetLoadingPrincipal());
        } else {
          // get the OriginAttributes
          OriginAttributes attrs;
+2 −2
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ ThirdPartyUtil::IsThirdPartyChannel(nsIChannel* aChannel, nsIURI* aURI,
        // Check if the channel itself is third-party to its own requestor.
        // Unforunately, we have to go through the loading principal.

        rv = loadInfo->LoadingPrincipal()->IsThirdPartyURI(channelURI,
        rv = loadInfo->GetLoadingPrincipal()->IsThirdPartyURI(channelURI,
                                                              &parentIsThird);
        if (NS_FAILED(rv)) {
          return rv;
+2 −2
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ inline const char* NS_CP_ContentTypeName(uint32_t contentType) {
inline nsresult NS_CheckContentLoadPolicy(
    nsIURI* contentLocation, nsILoadInfo* loadInfo, const nsACString& mimeType,
    int16_t* decision, nsIContentPolicy* policyService = nullptr) {
  nsIPrincipal* loadingPrincipal = loadInfo->LoadingPrincipal();
  nsIPrincipal* loadingPrincipal = loadInfo->GetLoadingPrincipal();
  nsCOMPtr<nsISupports> context = loadInfo->GetLoadingContext();
  nsContentPolicyType contentType = loadInfo->InternalContentPolicyType();
  CHECK_PRINCIPAL_CSP_AND_DATA(ShouldLoad);
@@ -238,7 +238,7 @@ inline nsresult NS_CheckContentLoadPolicy(
inline nsresult NS_CheckContentProcessPolicy(
    nsIURI* contentLocation, nsILoadInfo* loadInfo, const nsACString& mimeType,
    int16_t* decision, nsIContentPolicy* policyService = nullptr) {
  nsIPrincipal* loadingPrincipal = loadInfo->LoadingPrincipal();
  nsIPrincipal* loadingPrincipal = loadInfo->GetLoadingPrincipal();
  nsCOMPtr<nsISupports> context = loadInfo->GetLoadingContext();
  nsContentPolicyType contentType = loadInfo->InternalContentPolicyType();
  CHECK_PRINCIPAL_CSP_AND_DATA(ShouldProcess);
+1 −1
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ bool nsNodeInfoManager::InternalSVGEnabled() {
             nsIContentPolicy::TYPE_IMAGE ||
         loadInfo->GetExternalContentPolicyType() ==
             nsIContentPolicy::TYPE_OTHER) &&
        (IsSystemOrAddonPrincipal(loadInfo->LoadingPrincipal()) ||
        (IsSystemOrAddonPrincipal(loadInfo->GetLoadingPrincipal()) ||
         IsSystemOrAddonPrincipal(loadInfo->TriggeringPrincipal()))));
  mSVGEnabled = Some(conclusion);
  return conclusion;
+2 −2
Original line number Diff line number Diff line
@@ -811,8 +811,8 @@ BlobURLProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
  // principal and which is never mutated to have a non-zero mPrivateBrowsingId
  // or container.
  if (aLoadInfo &&
      (!aLoadInfo->LoadingPrincipal() ||
       !aLoadInfo->LoadingPrincipal()->IsSystemPrincipal()) &&
      (!aLoadInfo->GetLoadingPrincipal() ||
       !aLoadInfo->GetLoadingPrincipal()->IsSystemPrincipal()) &&
      !ChromeUtils::IsOriginAttributesEqualIgnoringFPD(
          aLoadInfo->GetOriginAttributes(),
          BasePrincipal::Cast(info->mPrincipal)->OriginAttributesRef())) {
Loading