зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1904004 - Use OriginAttributes::IsPrivateBrowsing instead of open coding PBM checks. r=timhuang,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,necko-reviewers,kershaw,dom-storage-reviewers,janv,canaltinova,dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D214532
This commit is contained in:
Родитель
64a746c174
Коммит
6613ec7689
|
@ -685,9 +685,9 @@ nsresult BasePrincipal::CheckMayLoadHelper(nsIURI* aURI,
|
|||
}
|
||||
|
||||
if (aReport) {
|
||||
nsScriptSecurityManager::ReportError(
|
||||
"CheckSameOriginError", prinURI, aURI,
|
||||
mOriginAttributes.mPrivateBrowsingId > 0, aInnerWindowID);
|
||||
nsScriptSecurityManager::ReportError("CheckSameOriginError", prinURI, aURI,
|
||||
mOriginAttributes.IsPrivateBrowsing(),
|
||||
aInnerWindowID);
|
||||
}
|
||||
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
|
|
|
@ -424,7 +424,7 @@ bool OriginAttributes::IsPrivateBrowsing(const nsACString& aOrigin) {
|
|||
return false;
|
||||
}
|
||||
|
||||
return !!attrs.mPrivateBrowsingId;
|
||||
return attrs.IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -741,8 +741,8 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
if (reportErrors) {
|
||||
ReportError("CheckLoadURI", sourceURI, aTargetURI,
|
||||
allowList.LastElement()
|
||||
->OriginAttributesRef()
|
||||
.mPrivateBrowsingId > 0,
|
||||
->OriginAttributesRef()
|
||||
.IsPrivateBrowsing(),
|
||||
aInnerWindowID);
|
||||
}
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
|
@ -794,8 +794,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
// access:
|
||||
rv = CheckLoadURIFlags(
|
||||
sourceURI, aTargetURI, sourceBaseURI, targetBaseURI, aFlags,
|
||||
aPrincipal->OriginAttributesRef().mPrivateBrowsingId > 0,
|
||||
aInnerWindowID);
|
||||
aPrincipal->OriginAttributesRef().IsPrivateBrowsing(), aInnerWindowID);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Check the principal is allowed to load the target.
|
||||
if (aFlags & nsIScriptSecurityManager::DONT_REPORT_ERRORS) {
|
||||
|
@ -926,7 +925,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
|||
isExtensionMismatch) {
|
||||
return CheckLoadURIFlags(
|
||||
currentURI, currentOtherURI, sourceBaseURI, targetBaseURI, aFlags,
|
||||
aPrincipal->OriginAttributesRef().mPrivateBrowsingId > 0,
|
||||
aPrincipal->OriginAttributesRef().IsPrivateBrowsing(),
|
||||
aInnerWindowID);
|
||||
}
|
||||
// Otherwise... check if we can nest another level:
|
||||
|
@ -1241,7 +1240,7 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(
|
|||
nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS};
|
||||
for (uint32_t i = 0; i < ArrayLength(flags); ++i) {
|
||||
uint32_t fixupFlags = flags[i];
|
||||
if (aPrincipal->OriginAttributesRef().mPrivateBrowsingId > 0) {
|
||||
if (aPrincipal->OriginAttributesRef().IsPrivateBrowsing()) {
|
||||
fixupFlags |= nsIURIFixup::FIXUP_FLAG_PRIVATE_CONTEXT;
|
||||
}
|
||||
nsCOMPtr<nsIURIFixupInfo> fixupInfo;
|
||||
|
|
|
@ -113,7 +113,7 @@ LoadContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) {
|
|||
|
||||
NS_ENSURE_ARG_POINTER(aUsePrivateBrowsing);
|
||||
|
||||
*aUsePrivateBrowsing = mOriginAttributes.mPrivateBrowsingId > 0;
|
||||
*aUsePrivateBrowsing = mOriginAttributes.IsPrivateBrowsing();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -9328,7 +9328,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
|
|||
// * https-first failed to upgrade request to https
|
||||
// * we already asked for permission to unload and the user accepted
|
||||
// otherwise we wouldn't be here.
|
||||
bool isPrivateWin = GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = GetOriginAttributes().IsPrivateBrowsing();
|
||||
bool isHistoryOrReload = false;
|
||||
uint32_t loadType = aLoadState->LoadType();
|
||||
|
||||
|
@ -11264,8 +11264,7 @@ nsDocShell::AddState(JS::Handle<JS::Value> aData, const nsAString& aTitle,
|
|||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(newURI->GetUserPass(newUserPass), NS_ERROR_FAILURE);
|
||||
bool isPrivateWin =
|
||||
document->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId >
|
||||
0;
|
||||
document->NodePrincipal()->OriginAttributesRef().IsPrivateBrowsing();
|
||||
if (NS_FAILED(secMan->CheckSameOriginURI(currentURI, newURI, true,
|
||||
isPrivateWin)) ||
|
||||
!currentUserPass.Equals(newUserPass)) {
|
||||
|
@ -12613,7 +12612,7 @@ bool nsDocShell::IsOKToLoadURI(nsIURI* aURI) {
|
|||
Document* doc = GetDocument();
|
||||
if (doc) {
|
||||
isPrivateWin =
|
||||
doc->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId > 0;
|
||||
doc->NodePrincipal()->OriginAttributesRef().IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
|
|
|
@ -163,7 +163,7 @@ static void SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
|
|||
bool isPrivateWin = false;
|
||||
if (doc) {
|
||||
isPrivateWin =
|
||||
doc->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId > 0;
|
||||
doc->NodePrincipal()->OriginAttributesRef().IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
bool sameOrigin = NS_SUCCEEDED(
|
||||
|
|
|
@ -2555,8 +2555,7 @@ bool nsContentUtils::ShouldResistFingerprinting_dangerous(
|
|||
const char* aJustification, RFPTarget aTarget) {
|
||||
// With this check, we can ensure that the prefs and target say yes, so only
|
||||
// an exemption would cause us to return false.
|
||||
bool isPBM = aOriginAttributes.mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID;
|
||||
bool isPBM = aOriginAttributes.IsPrivateBrowsing();
|
||||
if (!ShouldResistFingerprinting_("Positive return check", isPBM, aTarget)) {
|
||||
MOZ_LOG(nsContentUtils::ResistFingerprintingLog(), LogLevel::Debug,
|
||||
("Inside ShouldResistFingerprinting_dangerous(nsIURI*,"
|
||||
|
@ -2575,8 +2574,7 @@ bool nsContentUtils::ShouldResistFingerprinting_dangerous(
|
|||
// If neither of the 'regular' RFP prefs are set, then one (or both)
|
||||
// of the PBM-Only prefs are set (or we would have failed the
|
||||
// Positive return check.) Therefore, if we are not in PBM, return false
|
||||
if (aOriginAttributes.mPrivateBrowsingId ==
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID) {
|
||||
if (!aOriginAttributes.IsPrivateBrowsing()) {
|
||||
MOZ_LOG(nsContentUtils::ResistFingerprintingLog(), LogLevel::Debug,
|
||||
("Inside ShouldResistFingerprinting_dangerous(nsIURI*,"
|
||||
" OriginAttributes) OA PBM Check said false"));
|
||||
|
@ -2626,8 +2624,7 @@ bool nsContentUtils::ShouldResistFingerprinting_dangerous(
|
|||
BasePrincipal::Cast(aPrincipal)->OriginAttributesRef();
|
||||
// With this check, we can ensure that the prefs and target say yes, so only
|
||||
// an exemption would cause us to return false.
|
||||
bool isPBM = originAttributes.mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID;
|
||||
bool isPBM = originAttributes.IsPrivateBrowsing();
|
||||
if (!ShouldResistFingerprinting_("Positive return check", isPBM, aTarget)) {
|
||||
MOZ_LOG(nsContentUtils::ResistFingerprintingLog(), LogLevel::Debug,
|
||||
("Inside ShouldResistFingerprinting(nsIPrincipal*) Positive return "
|
||||
|
@ -6297,7 +6294,7 @@ void nsContentUtils::WarnScriptWasIgnored(Document* aDocument) {
|
|||
msg.AppendLiteral(" : ");
|
||||
}
|
||||
privateBrowsing =
|
||||
!!aDocument->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId;
|
||||
aDocument->NodePrincipal()->OriginAttributesRef().IsPrivateBrowsing();
|
||||
chromeContext = aDocument->NodePrincipal()->IsSystemPrincipal();
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ nsDataDocumentContentPolicy::ShouldLoad(nsIURI* aContentLocation,
|
|||
aContentLocation->GetAsciiSpec(targetSpec);
|
||||
nsScriptSecurityManager::ReportError(
|
||||
"ExternalDataError", sourceSpec, targetSpec,
|
||||
requestingPrincipal->OriginAttributesRef().mPrivateBrowsingId > 0);
|
||||
requestingPrincipal->OriginAttributesRef().IsPrivateBrowsing());
|
||||
}
|
||||
} else if ((contentType == ExtContentPolicy::TYPE_IMAGE ||
|
||||
contentType == ExtContentPolicy::TYPE_IMAGESET) &&
|
||||
|
|
|
@ -47,7 +47,7 @@ nsOpenURIInFrameParams::SetReferrerInfo(nsIReferrerInfo* aReferrerInfo) {
|
|||
NS_IMETHODIMP
|
||||
nsOpenURIInFrameParams::GetIsPrivate(bool* aIsPrivate) {
|
||||
NS_ENSURE_ARG_POINTER(aIsPrivate);
|
||||
*aIsPrivate = mOpenWindowInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
*aIsPrivate = mOpenWindowInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ already_AddRefed<CacheStorage> CacheStorage::CreateOnWorker(
|
|||
MOZ_DIAGNOSTIC_ASSERT(aWorkerPrivate);
|
||||
aWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (aWorkerPrivate->GetOriginAttributes().mPrivateBrowsingId > 0 &&
|
||||
if (aWorkerPrivate->GetOriginAttributes().IsPrivateBrowsing() &&
|
||||
!StaticPrefs::dom_cache_privateBrowsing_enabled()) {
|
||||
NS_WARNING("CacheStorage not supported during private browsing.");
|
||||
RefPtr<CacheStorage> ref = new CacheStorage(NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
|
|
@ -91,14 +91,14 @@ bool ClientInfo::IsPrivateBrowsing() const {
|
|||
switch (PrincipalInfo().type()) {
|
||||
case PrincipalInfo::TContentPrincipalInfo: {
|
||||
const auto& p = PrincipalInfo().get_ContentPrincipalInfo();
|
||||
return p.attrs().mPrivateBrowsingId != 0;
|
||||
return p.attrs().IsPrivateBrowsing();
|
||||
}
|
||||
case PrincipalInfo::TSystemPrincipalInfo: {
|
||||
return false;
|
||||
}
|
||||
case PrincipalInfo::TNullPrincipalInfo: {
|
||||
const auto& p = PrincipalInfo().get_NullPrincipalInfo();
|
||||
return p.attrs().mPrivateBrowsingId != 0;
|
||||
return p.attrs().IsPrivateBrowsing();
|
||||
}
|
||||
default: {
|
||||
// clients should never be expanded principals
|
||||
|
|
|
@ -114,7 +114,7 @@ class WebProgressListener final : public nsIWebProgressListener,
|
|||
nsCOMPtr<nsIScriptSecurityManager> securityManager =
|
||||
nsContentUtils::GetSecurityManager();
|
||||
bool isPrivateWin =
|
||||
wgp->DocumentPrincipal()->OriginAttributesRef().mPrivateBrowsingId > 0;
|
||||
wgp->DocumentPrincipal()->OriginAttributesRef().IsPrivateBrowsing();
|
||||
nsresult rv = securityManager->CheckSameOriginURI(
|
||||
wgp->GetDocumentURI(), mBaseURI, false, isPrivateWin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
|
@ -1321,7 +1321,7 @@ void Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
|
|||
|
||||
bool pb;
|
||||
if (NS_SUCCEEDED(loadContext->GetUsePrivateBrowsing(&pb))) {
|
||||
MOZ_ASSERT(pb == !!oa.mPrivateBrowsingId);
|
||||
MOZ_ASSERT(pb == oa.IsPrivateBrowsing());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1620,7 +1620,7 @@ bool Console::PopulateConsoleNotificationInTheTargetScope(
|
|||
event.mFunctionName = frame.mFunctionName;
|
||||
event.mTimeStamp = aData->mMicroSecondTimeStamp / PR_USEC_PER_MSEC;
|
||||
event.mMicroSecondTimeStamp = aData->mMicroSecondTimeStamp;
|
||||
event.mPrivate = !!aData->mOriginAttributes.mPrivateBrowsingId;
|
||||
event.mPrivate = aData->mOriginAttributes.IsPrivateBrowsing();
|
||||
|
||||
switch (aData->mMethodName) {
|
||||
case MethodLog:
|
||||
|
|
|
@ -1423,8 +1423,9 @@ already_AddRefed<Promise> FetchBody<Derived>::ConsumeBody(
|
|||
mozilla::ipc::PrincipalInfo::TSystemPrincipalInfo ||
|
||||
(principalInfo->type() ==
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo &&
|
||||
principalInfo->get_ContentPrincipalInfo().attrs().mPrivateBrowsingId ==
|
||||
0))) {
|
||||
!principalInfo->get_ContentPrincipalInfo()
|
||||
.attrs()
|
||||
.IsPrivateBrowsing()))) {
|
||||
blobStorageType = MutableBlobStorage::eCouldBeInTemporaryFile;
|
||||
}
|
||||
|
||||
|
|
|
@ -757,7 +757,7 @@ nsresult FetchDriver::HttpFetch(
|
|||
// then set request’s referrer policy to the user-set default policy.
|
||||
if (mRequest->ReferrerPolicy_() == ReferrerPolicy::_empty) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = httpChan->LoadInfo();
|
||||
bool isPrivate = loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivate = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
referrerPolicy =
|
||||
ReferrerInfo::GetDefaultReferrerPolicy(httpChan, uri, isPrivate);
|
||||
mRequest->SetReferrerPolicy(referrerPolicy);
|
||||
|
|
|
@ -1660,7 +1660,7 @@ nsresult HTMLFormElement::GetActionURL(nsIURI** aActionURL,
|
|||
1, // aColumnNumber
|
||||
nsIScriptError::warningFlag, "upgradeInsecureRequest"_ns,
|
||||
document->InnerWindowID(),
|
||||
!!document->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId);
|
||||
document->NodePrincipal()->OriginAttributesRef().IsPrivateBrowsing());
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -380,8 +380,7 @@ PersistenceType IDBFactory::GetPersistenceType(
|
|||
return PERSISTENCE_TYPE_PERSISTENT;
|
||||
}
|
||||
|
||||
if (aPrincipalInfo.get_ContentPrincipalInfo().attrs().mPrivateBrowsingId >
|
||||
0) {
|
||||
if (aPrincipalInfo.get_ContentPrincipalInfo().attrs().IsPrivateBrowsing()) {
|
||||
return PERSISTENCE_TYPE_PRIVATE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -815,9 +815,7 @@ void ContentChild::AddProfileToProcessName(const nsACString& aProfile) {
|
|||
nsCOMPtr<nsIPrincipal> isolationPrincipal =
|
||||
ContentParent::CreateRemoteTypeIsolationPrincipal(mRemoteType);
|
||||
if (isolationPrincipal) {
|
||||
// DEFAULT_PRIVATE_BROWSING_ID is the value when it's not private
|
||||
if (isolationPrincipal->OriginAttributesRef().mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID) {
|
||||
if (isolationPrincipal->OriginAttributesRef().IsPrivateBrowsing()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -859,11 +857,9 @@ void ContentChild::SetProcessName(const nsACString& aName,
|
|||
// DEFAULT_PRIVATE_BROWSING_ID is the value when it's not private
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("private = %d, pref = %d",
|
||||
isolationPrincipal->OriginAttributesRef().mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID,
|
||||
isolationPrincipal->OriginAttributesRef().IsPrivateBrowsing(),
|
||||
StaticPrefs::fission_processPrivateWindowSiteNames()));
|
||||
if (isolationPrincipal->OriginAttributesRef().mPrivateBrowsingId ==
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID
|
||||
if (!isolationPrincipal->OriginAttributesRef().IsPrivateBrowsing()
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// Nightly can show site names for private windows, with a second pref
|
||||
|| StaticPrefs::fission_processPrivateWindowSiteNames()
|
||||
|
@ -2102,11 +2098,10 @@ mozilla::ipc::IPCResult ContentChild::RecvClearStyleSheetCache(
|
|||
mozilla::ipc::IPCResult ContentChild::RecvClearImageCacheFromPrincipal(
|
||||
nsIPrincipal* aPrincipal) {
|
||||
imgLoader* loader;
|
||||
if (aPrincipal->OriginAttributesRef().mPrivateBrowsingId ==
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID) {
|
||||
loader = imgLoader::NormalLoader();
|
||||
} else {
|
||||
if (aPrincipal->OriginAttributesRef().IsPrivateBrowsing()) {
|
||||
loader = imgLoader::PrivateBrowsingLoader();
|
||||
} else {
|
||||
loader = imgLoader::NormalLoader();
|
||||
}
|
||||
|
||||
loader->RemoveEntriesInternal(aPrincipal, nullptr);
|
||||
|
|
|
@ -4164,9 +4164,9 @@ bool PeerConnectionImpl::ShouldForceProxy() const {
|
|||
if (mWindow && mWindow->GetExtantDoc() &&
|
||||
mWindow->GetExtantDoc()->GetPrincipal() &&
|
||||
mWindow->GetExtantDoc()
|
||||
->GetPrincipal()
|
||||
->OriginAttributesRef()
|
||||
.mPrivateBrowsingId > 0) {
|
||||
->GetPrincipal()
|
||||
->OriginAttributesRef()
|
||||
.IsPrivateBrowsing()) {
|
||||
isPBM = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -6058,14 +6058,14 @@ QuotaManager::GetInfoFromValidatedPrincipalInfo(
|
|||
|
||||
principalMetadata.mOrigin = origin;
|
||||
|
||||
if (info.attrs().mPrivateBrowsingId != 0) {
|
||||
if (info.attrs().IsPrivateBrowsing()) {
|
||||
QM_TRY_UNWRAP(principalMetadata.mStorageOrigin,
|
||||
EnsureStorageOriginFromOrigin(origin));
|
||||
} else {
|
||||
principalMetadata.mStorageOrigin = origin;
|
||||
}
|
||||
|
||||
principalMetadata.mIsPrivate = info.attrs().mPrivateBrowsingId != 0;
|
||||
principalMetadata.mIsPrivate = info.attrs().IsPrivateBrowsing();
|
||||
|
||||
return principalMetadata;
|
||||
}
|
||||
|
|
|
@ -1318,7 +1318,7 @@ nsresult ReferrerInfo::ComputeReferrer(nsIHttpChannel* aChannel) {
|
|||
ShouldIgnoreLessRestrictedPolicies(aChannel, mOriginalPolicy)) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
bool isPrivate = attrs.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = attrs.IsPrivateBrowsing();
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = aChannel->GetURI(getter_AddRefs(uri));
|
||||
|
|
|
@ -877,7 +877,7 @@ void nsCSPContext::flushConsoleMessages() {
|
|||
if (doc) {
|
||||
mInnerWindowID = doc->InnerWindowID();
|
||||
privateWindow =
|
||||
!!doc->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId;
|
||||
doc->NodePrincipal()->OriginAttributesRef().IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
mQueueUpMessages = false;
|
||||
|
@ -928,7 +928,7 @@ void nsCSPContext::logToConsole(const char* aName,
|
|||
nsCOMPtr<Document> doc = do_QueryReferent(mLoadingContext);
|
||||
if (doc) {
|
||||
privateWindow =
|
||||
!!doc->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId;
|
||||
doc->NodePrincipal()->OriginAttributesRef().IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
CSP_LogLocalizedStr(aName, aParams, sourceName, aSourceLine, aLineNumber,
|
||||
|
|
|
@ -1145,7 +1145,7 @@ void EnforceXFrameOptionsCheck(nsIChannel* aChannel,
|
|||
// log warning to console that xfo is ignored because of CSP
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
uint64_t innerWindowID = loadInfo->GetInnerWindowID();
|
||||
bool privateWindow = !!loadInfo->GetOriginAttributes().mPrivateBrowsingId;
|
||||
bool privateWindow = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
AutoTArray<nsString, 2> params = {u"x-frame-options"_ns,
|
||||
u"frame-ancestors"_ns};
|
||||
CSP_LogLocalizedStr("IgnoringSrcBecauseOfDirective", params,
|
||||
|
|
|
@ -80,7 +80,7 @@ void nsHTTPSOnlyUtils::PotentiallyFireHttpRequestToShortenTimout(
|
|||
}
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
|
||||
// if neither HTTPS-Only nor HTTPS-First mode is enabled, then there is
|
||||
// nothing to do here.
|
||||
|
@ -153,7 +153,7 @@ void nsHTTPSOnlyUtils::PotentiallyFireHttpRequestToShortenTimout(
|
|||
bool nsHTTPSOnlyUtils::ShouldUpgradeRequest(nsIURI* aURI,
|
||||
nsILoadInfo* aLoadInfo) {
|
||||
// 1. Check if the HTTPS-Only Mode is even enabled, before we do anything else
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (!IsHttpsOnlyModeEnabled(isPrivateWin)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ bool nsHTTPSOnlyUtils::ShouldUpgradeRequest(nsIURI* aURI,
|
|||
bool nsHTTPSOnlyUtils::ShouldUpgradeWebSocket(nsIURI* aURI,
|
||||
nsILoadInfo* aLoadInfo) {
|
||||
// 1. Check if the HTTPS-Only Mode is even enabled, before we do anything else
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (!IsHttpsOnlyModeEnabled(isPrivateWin)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ bool nsHTTPSOnlyUtils::IsUpgradeDowngradeEndlessLoop(
|
|||
const mozilla::EnumSet<UpgradeDowngradeEndlessLoopOptions>& aOptions) {
|
||||
// 1. Check if the HTTPS-Only/HTTPS-First is even enabled, before doing
|
||||
// anything else
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
bool enforceForHTTPSOnlyMode =
|
||||
IsHttpsOnlyModeEnabled(isPrivateWin) &&
|
||||
aOptions.contains(
|
||||
|
@ -355,7 +355,7 @@ bool nsHTTPSOnlyUtils::IsUpgradeDowngradeEndlessLoop(
|
|||
bool nsHTTPSOnlyUtils::ShouldUpgradeHttpsFirstRequest(nsIURI* aURI,
|
||||
nsILoadInfo* aLoadInfo) {
|
||||
// 1. Check if HTTPS-First Mode is enabled
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (!IsHttpsFirstModeEnabled(isPrivateWin) &&
|
||||
!(aLoadInfo->GetWasSchemelessInput() &&
|
||||
mozilla::StaticPrefs::dom_security_https_first_schemeless())) {
|
||||
|
@ -600,8 +600,7 @@ void nsHTTPSOnlyUtils::UpdateLoadStateAfterHTTPSFirstDowngrade(
|
|||
nsCOMPtr<nsIChannel> channel = aDocumentLoadListener->GetChannel();
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||
|
||||
bool isPrivateWin =
|
||||
loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
bool isSchemeless =
|
||||
loadInfo->GetWasSchemelessInput() &&
|
||||
!nsHTTPSOnlyUtils::IsHttpsFirstModeEnabled(isPrivateWin);
|
||||
|
@ -663,7 +662,7 @@ bool nsHTTPSOnlyUtils::CouldBeHttpsOnlyError(nsIChannel* aChannel,
|
|||
|
||||
// If HTTPS-Only Mode is not enabled, then there is nothing to do here.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (!IsHttpsOnlyModeEnabled(isPrivateWin)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -712,7 +711,7 @@ void nsHTTPSOnlyUtils::TestSitePermissionAndPotentiallyAddExemption(
|
|||
// If HTTPS-Only or HTTPS-First Mode is not enabled, then there is nothing to
|
||||
// do here.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
bool isHttpsOnly = IsHttpsOnlyModeEnabled(isPrivateWin);
|
||||
bool isHttpsFirst = IsHttpsFirstModeEnabled(isPrivateWin);
|
||||
bool isSchemelessHttpsFirst =
|
||||
|
@ -765,7 +764,7 @@ bool nsHTTPSOnlyUtils::IsSafeToAcceptCORSOrMixedContent(
|
|||
return false;
|
||||
}
|
||||
// Check if HTTPS-Only Mode is enabled for this request
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
return nsHTTPSOnlyUtils::IsHttpsOnlyModeEnabled(isPrivateWin);
|
||||
}
|
||||
|
||||
|
@ -823,7 +822,7 @@ void nsHTTPSOnlyUtils::LogMessage(const nsAString& aMessage, uint32_t aFlags,
|
|||
windowId, aURI);
|
||||
} else {
|
||||
// Send to browser console
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
nsContentUtils::LogSimpleConsoleError(message, category, isPrivateWin,
|
||||
true /* from chrome context */,
|
||||
aFlags);
|
||||
|
@ -892,7 +891,7 @@ bool nsHTTPSOnlyUtils::ShouldUpgradeConnection(nsILoadInfo* aLoadInfo) {
|
|||
}
|
||||
|
||||
// Check if the HTTPS-Only Mode is even enabled, before we do anything else
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = aLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (!IsHttpsOnlyModeEnabled(isPrivateWin) &&
|
||||
!IsHttpsFirstModeEnabled(isPrivateWin)) {
|
||||
return false;
|
||||
|
|
|
@ -808,7 +808,7 @@ nsresult nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
|
|||
1, // aColumnNumber
|
||||
nsIScriptError::errorFlag, "blockAllMixedContent"_ns,
|
||||
requestingWindow->Id(),
|
||||
!!aLoadInfo->GetOriginAttributes().mPrivateBrowsingId);
|
||||
aLoadInfo->GetOriginAttributes().IsPrivateBrowsing());
|
||||
*aDecision = REJECT_REQUEST;
|
||||
MOZ_LOG(
|
||||
sMCBLog, LogLevel::Verbose,
|
||||
|
|
|
@ -1670,7 +1670,7 @@ nsresult WebSocketImpl::Init(JSContext* aCx, bool aIsSecure,
|
|||
}
|
||||
}
|
||||
|
||||
mPrivateBrowsing = !!aPrincipal->OriginAttributesRef().mPrivateBrowsingId;
|
||||
mPrivateBrowsing = aPrincipal->OriginAttributesRef().IsPrivateBrowsing();
|
||||
mIsChromeContext = aPrincipal->IsSystemPrincipal();
|
||||
|
||||
// parses the url
|
||||
|
|
|
@ -6071,9 +6071,8 @@ PerformanceStorage* WorkerPrivate::GetPerformanceStorage() {
|
|||
bool WorkerPrivate::ShouldResistFingerprinting(RFPTarget aTarget) const {
|
||||
return mLoadInfo.mShouldResistFingerprinting &&
|
||||
nsRFPService::IsRFPEnabledFor(
|
||||
mLoadInfo.mOriginAttributes.mPrivateBrowsingId >
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID,
|
||||
aTarget, mLoadInfo.mOverriddenFingerprintingSettings);
|
||||
mLoadInfo.mOriginAttributes.IsPrivateBrowsing(), aTarget,
|
||||
mLoadInfo.mOverriddenFingerprintingSettings);
|
||||
}
|
||||
|
||||
void WorkerPrivate::SetRemoteWorkerController(RemoteWorkerChild* aController) {
|
||||
|
|
|
@ -131,7 +131,7 @@ nsresult CacheCreator::CreateCacheStorage(nsIPrincipal* aPrincipal) {
|
|||
// If we're in private browsing mode, don't even try to create the
|
||||
// CacheStorage. Instead, just fail immediately to terminate the
|
||||
// ServiceWorker load.
|
||||
if (NS_WARN_IF(mOriginAttributes.mPrivateBrowsingId > 0)) {
|
||||
if (NS_WARN_IF(mOriginAttributes.IsPrivateBrowsing())) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
|
|
|
@ -1391,11 +1391,10 @@ imgLoader::RemoveEntriesFromPrincipalInAllProcesses(nsIPrincipal* aPrincipal) {
|
|||
}
|
||||
|
||||
imgLoader* loader;
|
||||
if (aPrincipal->OriginAttributesRef().mPrivateBrowsingId ==
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID) {
|
||||
loader = imgLoader::NormalLoader();
|
||||
} else {
|
||||
if (aPrincipal->OriginAttributesRef().IsPrivateBrowsing()) {
|
||||
loader = imgLoader::PrivateBrowsingLoader();
|
||||
} else {
|
||||
loader = imgLoader::NormalLoader();
|
||||
}
|
||||
|
||||
return loader->RemoveEntriesInternal(aPrincipal, nullptr);
|
||||
|
|
|
@ -359,7 +359,7 @@ bool IsPrincipalInfoPrivate(const PrincipalInfo& aPrincipalInfo) {
|
|||
}
|
||||
|
||||
const ContentPrincipalInfo& info = aPrincipalInfo.get_ContentPrincipalInfo();
|
||||
return !!info.attrs().mPrivateBrowsingId;
|
||||
return info.attrs().IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIRedirectHistoryEntry> RHEntryInfoToRHEntry(
|
||||
|
|
|
@ -26,7 +26,7 @@ LoadContextInfo::LoadContextInfo(bool aIsAnonymous,
|
|||
mOriginAttributes(std::move(aOriginAttributes)) {}
|
||||
|
||||
NS_IMETHODIMP LoadContextInfo::GetIsPrivate(bool* aIsPrivate) {
|
||||
*aIsPrivate = mOriginAttributes.mPrivateBrowsingId > 0;
|
||||
*aIsPrivate = mOriginAttributes.IsPrivateBrowsing();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ LoadContextInfo* GetLoadContextInfo(nsIChannel* aChannel) {
|
|||
|
||||
OriginAttributes oa;
|
||||
StoragePrincipalHelper::GetOriginAttributesForNetworkState(aChannel, oa);
|
||||
MOZ_ASSERT(pb == (oa.mPrivateBrowsingId > 0));
|
||||
MOZ_ASSERT(pb == (oa.IsPrivateBrowsing()));
|
||||
|
||||
return new LoadContextInfo(anon, oa);
|
||||
}
|
||||
|
@ -139,8 +139,7 @@ LoadContextInfo* GetLoadContextInfo(nsILoadContext* aLoadContext,
|
|||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(aLoadContext);
|
||||
if (!docShell ||
|
||||
nsDocShell::Cast(docShell)->GetBrowsingContext()->IsContent()) {
|
||||
MOZ_ASSERT(aLoadContext->UsePrivateBrowsing() ==
|
||||
(oa.mPrivateBrowsingId > 0));
|
||||
MOZ_ASSERT(aLoadContext->UsePrivateBrowsing() == (oa.IsPrivateBrowsing()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow, nsIURI* aURI,
|
|||
// Let's take the current cookie behavior and current cookie permission
|
||||
// for the documents' loadInfo. Note that for any other loadInfos,
|
||||
// cookieBehavior will be BEHAVIOR_REJECT for security reasons.
|
||||
bool isPrivate = mOriginAttributes.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = mOriginAttributes.IsPrivateBrowsing();
|
||||
bool shouldResistFingerprinting =
|
||||
nsContentUtils::ShouldResistFingerprinting_dangerous(
|
||||
aURI, mOriginAttributes,
|
||||
|
@ -467,7 +467,7 @@ LoadInfo::LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext,
|
|||
}
|
||||
}
|
||||
|
||||
const bool isPrivate = mOriginAttributes.mPrivateBrowsingId > 0;
|
||||
const bool isPrivate = mOriginAttributes.IsPrivateBrowsing();
|
||||
|
||||
// Let's take the current cookie behavior and current cookie permission
|
||||
// for the documents' loadInfo. Note that for any other loadInfos,
|
||||
|
@ -1146,7 +1146,7 @@ already_AddRefed<nsICookieJarSettings> CreateCookieJarSettings(
|
|||
NS_IMETHODIMP
|
||||
LoadInfo::GetCookieJarSettings(nsICookieJarSettings** aCookieJarSettings) {
|
||||
if (!mCookieJarSettings) {
|
||||
bool isPrivate = mOriginAttributes.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = mOriginAttributes.IsPrivateBrowsing();
|
||||
nsCOMPtr<nsIPrincipal> loadingPrincipal;
|
||||
Unused << this->GetLoadingPrincipal(getter_AddRefs(loadingPrincipal));
|
||||
bool shouldResistFingerprinting =
|
||||
|
|
|
@ -519,7 +519,7 @@ Predictor::PredictNative(nsIURI* targetURI, nsIURI* sourceURI,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (originAttributes.mPrivateBrowsingId > 0) {
|
||||
if (originAttributes.IsPrivateBrowsing()) {
|
||||
// Don't want to do anything in PB mode
|
||||
PREDICTOR_LOG((" in PB mode"));
|
||||
return NS_OK;
|
||||
|
@ -1263,7 +1263,7 @@ Predictor::LearnNative(nsIURI* targetURI, nsIURI* sourceURI,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (originAttributes.mPrivateBrowsingId > 0) {
|
||||
if (originAttributes.IsPrivateBrowsing()) {
|
||||
// Don't want to do anything in PB mode
|
||||
PREDICTOR_LOG((" in PB mode"));
|
||||
return NS_OK;
|
||||
|
|
|
@ -75,7 +75,7 @@ class PrivateBrowsingChannel : public nsIPrivateBrowsingChannel {
|
|||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
mPrivateBrowsing = attrs.mPrivateBrowsingId > 0;
|
||||
mPrivateBrowsing = attrs.IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
bool CanSetCallbacks(nsIInterfaceRequestor* aCallbacks) const {
|
||||
|
|
|
@ -1132,7 +1132,7 @@ nsLoadGroup::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
|
||||
OriginAttributes attrs;
|
||||
StoragePrincipalHelper::GetRegularPrincipalOriginAttributes(this, attrs);
|
||||
if (attrs.mPrivateBrowsingId == 0) {
|
||||
if (!attrs.IsPrivateBrowsing()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -2126,7 +2126,7 @@ bool NS_UsePrivateBrowsing(nsIChannel* channel) {
|
|||
bool result = StoragePrincipalHelper::GetOriginAttributes(
|
||||
channel, attrs, StoragePrincipalHelper::eRegularPrincipal);
|
||||
NS_ENSURE_TRUE(result, result);
|
||||
return attrs.mPrivateBrowsingId > 0;
|
||||
return attrs.IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
bool NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport) {
|
||||
|
@ -2965,7 +2965,7 @@ static bool ShouldSecureUpgradeNoHSTS(nsIURI* aURI, nsILoadInfo* aLoadInfo) {
|
|||
1, // aColumnNumber
|
||||
nsIScriptError::warningFlag,
|
||||
"upgradeInsecureRequest"_ns, innerWindowId,
|
||||
!!aLoadInfo->GetOriginAttributes().mPrivateBrowsingId);
|
||||
aLoadInfo->GetOriginAttributes().IsPrivateBrowsing());
|
||||
Telemetry::AccumulateCategorical(
|
||||
Telemetry::LABELS_HTTP_SCHEME_UPGRADE_TYPE::CSP);
|
||||
return true;
|
||||
|
|
|
@ -135,7 +135,7 @@ already_AddRefed<nsICookieJarSettings> CookieJarSettings::Create(
|
|||
aPrincipal, "We are constructing CookieJarSettings here.",
|
||||
RFPTarget::IsAlwaysEnabledForPrecompute);
|
||||
|
||||
if (aPrincipal && aPrincipal->OriginAttributesRef().mPrivateBrowsingId > 0) {
|
||||
if (aPrincipal && aPrincipal->OriginAttributesRef().IsPrivateBrowsing()) {
|
||||
return Create(ePrivate, shouldResistFingerprinting);
|
||||
}
|
||||
|
||||
|
|
|
@ -822,9 +822,8 @@ CookieService::SetCookieStringFromHttp(nsIURI* aHostURI,
|
|||
moreCookieToRead = CanSetCookie(
|
||||
aHostURI, baseDomain, cookieData, requireHostMatch, cookieStatus,
|
||||
cookieHeader, true, isForeignAndNotAddon, mustBePartitioned,
|
||||
storagePrincipalOriginAttributes.mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID,
|
||||
crc, canSetCookie);
|
||||
storagePrincipalOriginAttributes.IsPrivateBrowsing(), crc,
|
||||
canSetCookie);
|
||||
|
||||
if (!canSetCookie) {
|
||||
continue;
|
||||
|
@ -1214,8 +1213,7 @@ void CookieService::GetCookiesForURI(
|
|||
// if opt-in partitioning is enabled.
|
||||
if (aIsForeign && cookieJarSettings->GetPartitionForeign() &&
|
||||
(StaticPrefs::network_cookie_cookieBehavior_optInPartitioning() ||
|
||||
(attrs.mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID &&
|
||||
(attrs.IsPrivateBrowsing() &&
|
||||
StaticPrefs::
|
||||
network_cookie_cookieBehavior_optInPartitioning_pbmode())) &&
|
||||
!(cookie->IsPartitioned() && cookie->RawIsPartitioned()) &&
|
||||
|
@ -2693,7 +2691,7 @@ bool CookieService::IsInitialized() const {
|
|||
CookieStorage* CookieService::PickStorage(const OriginAttributes& aAttrs) {
|
||||
MOZ_ASSERT(IsInitialized());
|
||||
|
||||
if (aAttrs.mPrivateBrowsingId > 0) {
|
||||
if (aAttrs.IsPrivateBrowsing()) {
|
||||
return mPrivateStorage;
|
||||
}
|
||||
|
||||
|
|
|
@ -702,9 +702,8 @@ CookieServiceChild::SetCookieStringFromHttp(nsIURI* aHostURI,
|
|||
moreCookies = CookieService::CanSetCookie(
|
||||
aHostURI, baseDomain, cookieData, requireHostMatch, cookieStatus,
|
||||
cookieString, true, isForeignAndNotAddon, mustBePartitioned,
|
||||
storagePrincipalOriginAttributes.mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID,
|
||||
crc, canSetCookie);
|
||||
storagePrincipalOriginAttributes.IsPrivateBrowsing(), crc,
|
||||
canSetCookie);
|
||||
if (!canSetCookie) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -603,7 +603,7 @@ nsresult nsHostResolver::ResolveHost(const nsACString& aHost,
|
|||
}
|
||||
|
||||
nsHostKey key(host, aTrrServer, type, flags, af,
|
||||
(aOriginAttributes.mPrivateBrowsingId > 0), originSuffix);
|
||||
(aOriginAttributes.IsPrivateBrowsing()), originSuffix);
|
||||
|
||||
// Check if we have a localhost domain, if so hardcode to loopback
|
||||
if (IS_ADDR_TYPE(type) && IsLoopbackHostname(host)) {
|
||||
|
@ -678,7 +678,7 @@ nsresult nsHostResolver::ResolveHost(const nsACString& aHost,
|
|||
} else if (!rec->mResolving) {
|
||||
result =
|
||||
FromUnspecEntry(rec, host, aTrrServer, originSuffix, type, flags, af,
|
||||
aOriginAttributes.mPrivateBrowsingId > 0, status);
|
||||
aOriginAttributes.IsPrivateBrowsing(), status);
|
||||
// If this is a by-type request or if no valid record was found
|
||||
// in the cache or this is an AF_UNSPEC request, then start a
|
||||
// new lookup.
|
||||
|
@ -903,7 +903,7 @@ void nsHostResolver::DetachCallback(
|
|||
aOriginAttributes.CreateSuffix(originSuffix);
|
||||
|
||||
nsHostKey key(host, aTrrServer, aType, flags, af,
|
||||
(aOriginAttributes.mPrivateBrowsingId > 0), originSuffix);
|
||||
(aOriginAttributes.IsPrivateBrowsing()), originSuffix);
|
||||
RefPtr<nsHostRecord> entry = mRecordDB.Get(key);
|
||||
if (entry) {
|
||||
// walk list looking for |callback|... we cannot assume
|
||||
|
@ -1883,7 +1883,7 @@ void nsHostResolver::CancelAsyncRequest(
|
|||
// Lookup the host record associated with host, flags & address family
|
||||
|
||||
nsHostKey key(host, aTrrServer, aType, flags, af,
|
||||
(aOriginAttributes.mPrivateBrowsingId > 0), originSuffix);
|
||||
(aOriginAttributes.IsPrivateBrowsing()), originSuffix);
|
||||
RefPtr<nsHostRecord> rec = mRecordDB.Get(key);
|
||||
if (!rec) {
|
||||
return;
|
||||
|
|
|
@ -2502,7 +2502,7 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
|||
// do not kick in.
|
||||
if (httpChannel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = httpChannel->LoadInfo();
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (nsHTTPSOnlyUtils::IsHttpsOnlyModeEnabled(isPrivateWin)) {
|
||||
uint32_t httpsOnlyStatus = loadInfo->GetHttpsOnlyStatus();
|
||||
httpsOnlyStatus |= nsILoadInfo::HTTPS_ONLY_TOP_LEVEL_LOAD_IN_PROGRESS;
|
||||
|
|
|
@ -86,7 +86,7 @@ NeckoParent::NeckoParent() : mSocketProcessBridgeInited(false) {
|
|||
static PBOverrideStatus PBOverrideStatusFromLoadContext(
|
||||
const SerializedLoadContext& aSerialized) {
|
||||
if (!aSerialized.IsNotNull() && aSerialized.IsPrivateBitValid()) {
|
||||
return (aSerialized.mOriginAttributes.mPrivateBrowsingId > 0)
|
||||
return aSerialized.mOriginAttributes.IsPrivateBrowsing()
|
||||
? kPBOverride_Private
|
||||
: kPBOverride_NotPrivate;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ const char* NeckoParent::CreateChannelLoadContext(
|
|||
// the common case for most xpcshell tests.
|
||||
if (aSerialized.IsNotNull()) {
|
||||
attrs.SyncAttributesWithPrivateBrowsing(
|
||||
aSerialized.mOriginAttributes.mPrivateBrowsingId > 0);
|
||||
aSerialized.mOriginAttributes.IsPrivateBrowsing());
|
||||
|
||||
RefPtr<BrowserParent> browserParent = BrowserParent::GetFrom(aBrowser);
|
||||
dom::Element* topFrameElement = nullptr;
|
||||
|
|
|
@ -1774,7 +1774,7 @@ HttpBaseChannel::IsThirdPartyTrackingResource(bool* aIsTrackingResource) {
|
|||
!(mFirstPartyClassificationFlags && mThirdPartyClassificationFlags));
|
||||
*aIsTrackingResource = UrlClassifierCommon::IsTrackingClassificationFlag(
|
||||
mThirdPartyClassificationFlags,
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0);
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2515,7 +2515,7 @@ bool HttpBaseChannel::IsBrowsingContextDiscarded() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
return mLoadInfo->GetOriginAttributes().mPrivateBrowsingId != 0 &&
|
||||
return mLoadInfo->GetOriginAttributes().IsPrivateBrowsing() &&
|
||||
!dom::CanonicalBrowsingContext::IsPrivateBrowsingActive();
|
||||
}
|
||||
|
||||
|
@ -5279,7 +5279,7 @@ bool HttpBaseChannel::ShouldTaintReplacementChannelOrigin(
|
|||
// Redirect Tracking
|
||||
bool HttpBaseChannel::SameOriginWithOriginalUri(nsIURI* aURI) {
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
bool isPrivateWin = mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = mLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
nsresult rv =
|
||||
ssm->CheckSameOriginURI(aURI, mOriginalURI, false, isPrivateWin);
|
||||
return (NS_SUCCEEDED(rv));
|
||||
|
|
|
@ -1013,7 +1013,7 @@ void HttpChannelChild::OnStopRequest(
|
|||
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
|
||||
mLastStatusReported, now, mTransferSize, kCacheUnknown,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
&mTransactionTimings, std::move(mSource),
|
||||
Some(nsDependentCString(contentType.get())));
|
||||
}
|
||||
|
@ -1605,7 +1605,7 @@ void HttpChannelChild::Redirect1Begin(
|
|||
mURI, requestMethod, mPriority, mChannelId,
|
||||
NetworkLoadType::LOAD_REDIRECT, mLastStatusReported, TimeStamp::Now(),
|
||||
0, kCacheUnknown, mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
&mTransactionTimings, std::move(mSource),
|
||||
Some(nsDependentCString(contentType.get())), newOriginalURI,
|
||||
redirectFlags, channelId);
|
||||
|
@ -1928,7 +1928,7 @@ HttpChannelChild::CompleteRedirectSetup(nsIStreamListener* aListener) {
|
|||
mURI, requestMethod, mPriority, mChannelId, NetworkLoadType::LOAD_START,
|
||||
mChannelCreationTimestamp, mLastStatusReported, 0, kCacheUnknown,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0);
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing());
|
||||
}
|
||||
StoreIsPending(true);
|
||||
StoreWasOpened(true);
|
||||
|
@ -2269,7 +2269,7 @@ nsresult HttpChannelChild::AsyncOpenInternal(nsIStreamListener* aListener) {
|
|||
mURI, requestMethod, mPriority, mChannelId, NetworkLoadType::LOAD_START,
|
||||
mChannelCreationTimestamp, mLastStatusReported, 0, kCacheUnknown,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0);
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing());
|
||||
}
|
||||
StoreIsPending(true);
|
||||
StoreWasOpened(true);
|
||||
|
@ -3263,7 +3263,7 @@ HttpChannelChild::LogBlockedCORSRequest(const nsAString& aMessage,
|
|||
const nsACString& aCategory,
|
||||
bool aIsWarning) {
|
||||
uint64_t innerWindowID = mLoadInfo->GetInnerWindowID();
|
||||
bool privateBrowsing = !!mLoadInfo->GetOriginAttributes().mPrivateBrowsingId;
|
||||
bool privateBrowsing = mLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
bool fromChromeContext =
|
||||
mLoadInfo->TriggeringPrincipal()->IsSystemPrincipal();
|
||||
nsCORSListenerProxy::LogBlockedCORSRequest(innerWindowID, privateBrowsing,
|
||||
|
|
|
@ -110,7 +110,7 @@ void InterceptedHttpChannel::AsyncOpenInternal() {
|
|||
mURI, requestMethod, mPriority, mChannelId, NetworkLoadType::LOAD_START,
|
||||
mChannelCreationTimestamp, mLastStatusReported, 0, kCacheUnknown,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0);
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing());
|
||||
}
|
||||
|
||||
// If an error occurs in this file we must ensure mListener callbacks are
|
||||
|
@ -550,7 +550,7 @@ InterceptedHttpChannel::Cancel(nsresult aStatus) {
|
|||
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_CANCEL,
|
||||
mLastStatusReported, TimeStamp::Now(), size, kCacheUnknown,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
&mTransactionTimings, std::move(mSource));
|
||||
}
|
||||
|
||||
|
@ -779,7 +779,7 @@ InterceptedHttpChannel::ResetInterception(bool aBypass) {
|
|||
mURI, requestMethod, priority, mChannelId,
|
||||
NetworkLoadType::LOAD_REDIRECT, mLastStatusReported, TimeStamp::Now(),
|
||||
size, kCacheUnknown, mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
&mTransactionTimings, std::move(mSource),
|
||||
Some(nsDependentCString(contentType.get())), mURI, flags,
|
||||
newBaseChannel->ChannelId());
|
||||
|
@ -1224,7 +1224,7 @@ InterceptedHttpChannel::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
|
|||
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
|
||||
mLastStatusReported, TimeStamp::Now(), size, kCacheUnknown,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
&mTransactionTimings, std::move(mSource),
|
||||
Some(nsDependentCString(contentType.get())));
|
||||
}
|
||||
|
|
|
@ -308,7 +308,7 @@ nsPreflightCache::CacheEntry* nsPreflightCache::GetEntry(
|
|||
// This is a new entry, allocate and insert into the table now so that any
|
||||
// failures don't cause items to be removed from a full cache.
|
||||
auto newEntry =
|
||||
MakeUnique<CacheEntry>(key, aOriginAttributes.mPrivateBrowsingId != 0);
|
||||
MakeUnique<CacheEntry>(key, aOriginAttributes.IsPrivateBrowsing());
|
||||
|
||||
NS_ASSERTION(mTable.Count() <= PREFLIGHT_CACHE_SIZE,
|
||||
"Something is borked, too many entries in the cache!");
|
||||
|
|
|
@ -5419,7 +5419,7 @@ nsresult nsHttpChannel::SetupReplacementChannel(nsIURI* newURI,
|
|||
mURI, requestMethod, priority, mChannelId,
|
||||
NetworkLoadType::LOAD_REDIRECT, mLastStatusReported, TimeStamp::Now(),
|
||||
size, mCacheDisposition, mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0, &timings,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(), &timings,
|
||||
std::move(mSource), Some(nsDependentCString(contentType.get())), newURI,
|
||||
redirectFlags, channelId);
|
||||
}
|
||||
|
@ -6028,7 +6028,7 @@ nsresult nsHttpChannel::CancelInternal(nsresult status) {
|
|||
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_CANCEL,
|
||||
mLastStatusReported, TimeStamp::Now(), size, mCacheDisposition,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
&mTransactionTimings, std::move(mSource));
|
||||
}
|
||||
|
||||
|
@ -6377,7 +6377,7 @@ void nsHttpChannel::AsyncOpenFinal(TimeStamp aTimeStamp) {
|
|||
mURI, requestMethod, mPriority, mChannelId, NetworkLoadType::LOAD_START,
|
||||
mChannelCreationTimestamp, mLastStatusReported, 0, mCacheDisposition,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0);
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing());
|
||||
}
|
||||
|
||||
// Added due to PauseTask/DelayHttpChannel
|
||||
|
@ -8376,7 +8376,7 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
|
|||
mURI, requestMethod, priority, mChannelId, NetworkLoadType::LOAD_STOP,
|
||||
mLastStatusReported, TimeStamp::Now(), size, mCacheDisposition,
|
||||
mLoadInfo->GetInnerWindowID(),
|
||||
mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0,
|
||||
mLoadInfo->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
&mTransactionTimings, std::move(mSource),
|
||||
Some(nsDependentCString(contentType.get())));
|
||||
}
|
||||
|
@ -10454,7 +10454,7 @@ void nsHttpChannel::ReEvaluateReferrerAfterTrackingStatusIsKnown() {
|
|||
cjs = net::CookieJarSettings::Create(mLoadInfo->GetLoadingPrincipal());
|
||||
}
|
||||
if (cjs->GetRejectThirdPartyContexts()) {
|
||||
bool isPrivate = mLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivate = mLoadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
// If our referrer has been set before, and our referrer policy is unset
|
||||
// (default policy) if we thought the channel wasn't a third-party
|
||||
// tracking channel, we may need to set our referrer with referrer policy
|
||||
|
|
|
@ -2315,7 +2315,7 @@ nsresult nsHttpHandler::SpeculativeConnectInternal(
|
|||
new nsHttpConnectionInfo(host, port, ""_ns, username, nullptr,
|
||||
originAttributes, aURI->SchemeIs("https"));
|
||||
ci->SetAnonymous(anonymous);
|
||||
if (originAttributes.mPrivateBrowsingId > 0) {
|
||||
if (originAttributes.IsPrivateBrowsing()) {
|
||||
ci->SetPrivate(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ static SECStatus CertIDHash(SHA384Buffer& buf, const CertID& certID,
|
|||
}
|
||||
|
||||
bool isolateByPartitionKey =
|
||||
originAttributes.mPrivateBrowsingId > 0
|
||||
originAttributes.IsPrivateBrowsing()
|
||||
? StaticPrefs::privacy_partition_network_state_ocsp_cache_pbmode()
|
||||
: StaticPrefs::privacy_partition_network_state_ocsp_cache();
|
||||
if (isolateByPartitionKey) {
|
||||
|
|
|
@ -427,7 +427,7 @@ bool nsClientAuthRememberService::IsPrivateBrowsingKey(
|
|||
|
||||
nsIDataStorage::DataType nsClientAuthRememberService::GetDataStorageType(
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
if (aOriginAttributes.mPrivateBrowsingId > 0) {
|
||||
if (aOriginAttributes.IsPrivateBrowsing()) {
|
||||
return nsIDataStorage::DataType::Private;
|
||||
}
|
||||
return nsIDataStorage::DataType::Persistent;
|
||||
|
|
|
@ -1130,7 +1130,7 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) {
|
|||
msg.AppendLiteral(" : server does not support RFC 5746, see CVE-2009-3555");
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(
|
||||
msg, "SSL"_ns, !!infoObject->GetOriginAttributes().mPrivateBrowsingId,
|
||||
msg, "SSL"_ns, infoObject->GetOriginAttributes().IsPrivateBrowsing(),
|
||||
true /* from chrome context */);
|
||||
}
|
||||
|
||||
|
|
|
@ -1726,8 +1726,7 @@ nsresult nsSSLIOLayerAddToSocket(int32_t family, const char* host, int32_t port,
|
|||
sharedState = allocatedState.get();
|
||||
} else {
|
||||
bool isPrivate = providerFlags & nsISocketProvider::NO_PERMANENT_STORAGE ||
|
||||
originAttributes.mPrivateBrowsingId !=
|
||||
OriginAttributes().mPrivateBrowsingId;
|
||||
originAttributes.IsPrivateBrowsing();
|
||||
sharedState = isPrivate ? PrivateSSLState() : PublicSSLState();
|
||||
}
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ nsresult nsSiteSecurityService::SetHSTSState(
|
|||
nsAutoCString stateString;
|
||||
siteState.ToString(stateString);
|
||||
SSSLOG(("SSS: setting state for %s", hostname.get()));
|
||||
bool isPrivate = aOriginAttributes.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = aOriginAttributes.IsPrivateBrowsing();
|
||||
nsIDataStorage::DataType storageType =
|
||||
isPrivate ? nsIDataStorage::DataType::Private
|
||||
: nsIDataStorage::DataType::Persistent;
|
||||
|
@ -364,7 +364,7 @@ nsresult nsSiteSecurityService::SetHSTSState(
|
|||
// using the preloaded information.
|
||||
nsresult nsSiteSecurityService::MarkHostAsNotHSTS(
|
||||
const nsAutoCString& aHost, const OriginAttributes& aOriginAttributes) {
|
||||
bool isPrivate = aOriginAttributes.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = aOriginAttributes.IsPrivateBrowsing();
|
||||
nsIDataStorage::DataType storageType =
|
||||
isPrivate ? nsIDataStorage::DataType::Private
|
||||
: nsIDataStorage::DataType::Persistent;
|
||||
|
@ -492,7 +492,7 @@ nsresult nsSiteSecurityService::ResetStateInternal(
|
|||
|
||||
void nsSiteSecurityService::ResetStateForExactDomain(
|
||||
const nsCString& aHostname, const OriginAttributes& aOriginAttributes) {
|
||||
bool isPrivate = aOriginAttributes.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = aOriginAttributes.IsPrivateBrowsing();
|
||||
nsIDataStorage::DataType storageType =
|
||||
isPrivate ? nsIDataStorage::DataType::Private
|
||||
: nsIDataStorage::DataType::Persistent;
|
||||
|
@ -864,7 +864,7 @@ nsresult nsSiteSecurityService::HostMatchesHSTSEntry(
|
|||
// Additionally, if it is a knockout entry, we want to stop looking for data
|
||||
// on the host, because the knockout entry indicates "we have no information
|
||||
// regarding the security status of this host".
|
||||
bool isPrivate = aOriginAttributes.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = aOriginAttributes.IsPrivateBrowsing();
|
||||
nsIDataStorage::DataType storageType =
|
||||
isPrivate ? nsIDataStorage::DataType::Private
|
||||
: nsIDataStorage::DataType::Persistent;
|
||||
|
|
|
@ -271,7 +271,7 @@ nsresult ContentBlockingAllowListCache::CheckForBaseDomain(
|
|||
nsresult rv = EnsureInit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aOriginAttributes.mPrivateBrowsingId > 0) {
|
||||
if (aOriginAttributes.IsPrivateBrowsing()) {
|
||||
aIsAllowListed = mEntriesPrivateBrowsing.Contains(aBaseDomain);
|
||||
} else {
|
||||
aIsAllowListed = mEntries.Contains(aBaseDomain);
|
||||
|
@ -351,7 +351,7 @@ nsresult ContentBlockingAllowListCache::EnsureInit() {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Sort base domains into sets for normal / private browsing.
|
||||
if (principal->OriginAttributesRef().mPrivateBrowsingId > 0) {
|
||||
if (principal->OriginAttributesRef().IsPrivateBrowsing()) {
|
||||
mEntriesPrivateBrowsing.Insert(baseDomain);
|
||||
} else {
|
||||
mEntries.Insert(baseDomain);
|
||||
|
|
|
@ -447,7 +447,7 @@ bool StoragePrincipalHelper::GetOriginAttributes(
|
|||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
loadInfo->GetOriginAttributes(&aAttributes);
|
||||
|
||||
bool isPrivate = aAttributes.mPrivateBrowsingId > 0;
|
||||
bool isPrivate = aAttributes.IsPrivateBrowsing();
|
||||
nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(aChannel);
|
||||
if (pbChannel) {
|
||||
nsresult rv = pbChannel->GetIsChannelPrivate(&isPrivate);
|
||||
|
|
|
@ -83,9 +83,7 @@ nsresult BounceTrackingProtectionStorage::ClearBySiteHost(
|
|||
|
||||
// Update the database.
|
||||
// Private browsing data is not written to disk.
|
||||
if (aOriginAttributes &&
|
||||
aOriginAttributes->mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID) {
|
||||
if (aOriginAttributes && aOriginAttributes->IsPrivateBrowsing()) {
|
||||
return NS_OK;
|
||||
}
|
||||
return DeleteDBEntries(aOriginAttributes, aSiteHost);
|
||||
|
|
|
@ -31,8 +31,7 @@ class BounceTrackingStateGlobal final {
|
|||
const OriginAttributes& aAttrs);
|
||||
|
||||
bool IsPrivateBrowsing() const {
|
||||
return mOriginAttributes.mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID;
|
||||
return mOriginAttributes.IsPrivateBrowsing();
|
||||
}
|
||||
|
||||
bool ShouldPersistToDisk() const { return !IsPrivateBrowsing(); }
|
||||
|
|
|
@ -289,9 +289,7 @@ nsresult nsCookieBannerTelemetryService::MaybeReportGoogleGDPRChoiceTelemetry(
|
|||
|
||||
// We only report cookies for the default originAttributes or private
|
||||
// browsing mode.
|
||||
if (attrs.mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID ||
|
||||
attrs == OriginAttributes()) {
|
||||
if (attrs.IsPrivateBrowsing() || attrs == OriginAttributes()) {
|
||||
cookies.AppendElement(RefPtr<nsICookie>(aCookie));
|
||||
}
|
||||
} else {
|
||||
|
@ -345,8 +343,7 @@ nsresult nsCookieBannerTelemetryService::MaybeReportGoogleGDPRChoiceTelemetry(
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool isPrivateBrowsing =
|
||||
cookie->AsCookie().OriginAttributesRef().mPrivateBrowsingId !=
|
||||
nsIScriptSecurityManager::DEFAULT_PRIVATE_BROWSING_ID;
|
||||
cookie->AsCookie().OriginAttributesRef().IsPrivateBrowsing();
|
||||
|
||||
MOZ_LOG(gCookieBannerTelemetryLog, LogLevel::Debug,
|
||||
("Record the Google GDPR choice %s on the host %s in region %s for "
|
||||
|
|
|
@ -649,7 +649,7 @@ bool ChannelWrapper::Matches(
|
|||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = GetLoadInfo();
|
||||
bool isPrivate =
|
||||
loadInfo && loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
loadInfo && loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (!aFilter.mIncognito.IsNull() && aFilter.mIncognito.Value() != isPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ ProfilerThreadId DoStreamSamplesAndMarkers(
|
|||
aWriter.StringProperty("eTLD+1", aETLDplus1);
|
||||
} else {
|
||||
aWriter.StringProperty("eTLD+1", originNoSuffix);
|
||||
aWriter.BoolProperty("isPrivateBrowsing", attrs.mPrivateBrowsingId > 0);
|
||||
aWriter.BoolProperty("isPrivateBrowsing", attrs.IsPrivateBrowsing());
|
||||
aWriter.IntProperty("userContextId", attrs.mUserContextId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1549,7 +1549,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
|
|||
// the download is in progress we set that flag so that timeout counter
|
||||
// measures do not kick in.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
||||
bool isPrivateWin = loadInfo->GetOriginAttributes().IsPrivateBrowsing();
|
||||
if (nsHTTPSOnlyUtils::IsHttpsOnlyModeEnabled(isPrivateWin) ||
|
||||
nsHTTPSOnlyUtils::IsHttpsFirstModeEnabled(isPrivateWin)) {
|
||||
uint32_t httpsOnlyStatus = loadInfo->GetHttpsOnlyStatus();
|
||||
|
|
Загрузка…
Ссылка в новой задаче