From 8907cc5504398c37b2c5012bc103fc9ff309ad3f Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Tue, 19 Dec 2023 09:11:11 +0000 Subject: [PATCH] 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 --- netwerk/base/LoadInfo.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp index 7e8b75f0156b..a412619759e0 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -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 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."); } }