Bug 1870615. Avoid a few calls in opt builds in LoadInfo.cpp that we only need for an assert. r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D196719
This commit is contained in:
Timothy Nikkel 2023-12-19 09:11:11 +00:00
parent e151a8652e
commit 8907cc5504

View File

@ -295,19 +295,13 @@ LoadInfo::LoadInfo(
mOriginAttributes.SyncAttributesWithPrivateBrowsing(usePrivateBrowsing);
}
}
}
// For chrome docshell, the mPrivateBrowsingId remains 0 even its
// UsePrivateBrowsing() is true, so we only update the mPrivateBrowsingId in
// origin attributes if the type of the docshell is content.
if (aLoadingContext) {
nsCOMPtr<nsIDocShell> docShell = aLoadingContext->OwnerDoc()->GetDocShell();
if (docShell) {
if (docShell->GetBrowsingContext()->IsChrome()) {
MOZ_ASSERT(mOriginAttributes.mPrivateBrowsingId == 0,
"chrome docshell shouldn't have mPrivateBrowsingId set.");
}
}
// For chrome docshell, the mPrivateBrowsingId remains 0 even its
// UsePrivateBrowsing() is true, so we only update the mPrivateBrowsingId in
// origin attributes if the type of the docshell is content.
MOZ_ASSERT(!docShell || !docShell->GetBrowsingContext()->IsChrome() ||
mOriginAttributes.mPrivateBrowsingId == 0,
"chrome docshell shouldn't have mPrivateBrowsingId set.");
}
}