Bug 1517588. Use nsIPrincipal::IsSystemPrincipal instead of nsContentUtils::IsSystemPrincipal r=bzbarsky

Differential Revision: https://phabricator.services.mozilla.com/D53067
This commit is contained in:
Boris Zbarsky
2019-12-05 04:44:32 +00:00
parent 3bd161dd4f
commit 2df1df0176
90 changed files with 240 additions and 190 deletions

View File

@@ -14,6 +14,7 @@
#include "nsIWebNavigation.h"
#include "nsIChildChannel.h"
#include "ReferrerInfo.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/dom/LoadURIOptionsBinding.h"
#include "mozilla/StaticPrefs_fission.h"
@@ -522,7 +523,7 @@ nsresult nsDocShellLoadState::SetupInheritingPrincipal(
// created later from the channel's internal data.
mPrincipalToInherit = mTriggeringPrincipal;
if (mPrincipalToInherit && aItemType != nsIDocShellTreeItem::typeChrome) {
if (nsContentUtils::IsSystemPrincipal(mPrincipalToInherit)) {
if (mPrincipalToInherit->IsSystemPrincipal()) {
if (mPrincipalIsExplicit) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@@ -591,8 +592,9 @@ void nsDocShellLoadState::CalculateLoadURIFlags() {
mLoadFlags = 0;
if (mInheritPrincipal) {
MOZ_ASSERT(!nsContentUtils::IsSystemPrincipal(mPrincipalToInherit),
"Should not inherit SystemPrincipal");
MOZ_ASSERT(
!mPrincipalToInherit || !mPrincipalToInherit->IsSystemPrincipal(),
"Should not inherit SystemPrincipal");
mLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL;
}