From f20ecbedcd6a7c866083409dc091e80a5112c89b Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Mon, 22 Jan 2024 14:26:10 +0000 Subject: [PATCH] Bug 1875466 - Remove nsContentUtils::ShouldHideObjectOrEmbedImageDocument. r=emilio Depends on D199114 Differential Revision: https://phabricator.services.mozilla.com/D199115 --- docshell/base/BrowsingContext.cpp | 3 +-- docshell/base/WindowContext.cpp | 4 +--- dom/base/Document.cpp | 8 +++----- dom/base/nsContentUtils.cpp | 8 -------- dom/base/nsContentUtils.h | 6 ------ modules/libpref/init/StaticPrefList.yaml | 10 ---------- 6 files changed, 5 insertions(+), 34 deletions(-) diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 0ef5e02d2ae3..99264e736671 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -773,8 +773,7 @@ void BrowsingContext::SetEmbedderElement(Element* aEmbedder) { "browsing-context-did-set-embedder", nullptr); } - if (nsContentUtils::ShouldHideObjectOrEmbedImageDocument() && - IsEmbedderTypeObjectOrEmbed()) { + if (IsEmbedderTypeObjectOrEmbed()) { Unused << SetSyntheticDocumentContainer(true); } } diff --git a/docshell/base/WindowContext.cpp b/docshell/base/WindowContext.cpp index 03f33fe4139e..d2032bc55170 100644 --- a/docshell/base/WindowContext.cpp +++ b/docshell/base/WindowContext.cpp @@ -124,8 +124,7 @@ void WindowContext::AppendChildBrowsingContext( MOZ_DIAGNOSTIC_ASSERT(!mChildren.Contains(aBrowsingContext)); mChildren.AppendElement(aBrowsingContext); - if (!nsContentUtils::ShouldHideObjectOrEmbedImageDocument() || - !aBrowsingContext->IsEmbedderTypeObjectOrEmbed()) { + if (!aBrowsingContext->IsEmbedderTypeObjectOrEmbed()) { mNonSyntheticChildren.AppendElement(aBrowsingContext); } @@ -153,7 +152,6 @@ void WindowContext::RemoveChildBrowsingContext( void WindowContext::UpdateChildSynthetic(BrowsingContext* aBrowsingContext, bool aIsSynthetic) { - MOZ_ASSERT(nsContentUtils::ShouldHideObjectOrEmbedImageDocument()); if (aIsSynthetic) { mNonSyntheticChildren.RemoveElement(aBrowsingContext); } else { diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index b69aa3550b8b..739073ba17db 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -17397,11 +17397,9 @@ Selection* Document::GetSelection(ErrorResult& aRv) { } void Document::MakeBrowsingContextNonSynthetic() { - if (nsContentUtils::ShouldHideObjectOrEmbedImageDocument()) { - if (BrowsingContext* bc = GetBrowsingContext()) { - if (bc->GetSyntheticDocumentContainer()) { - Unused << bc->SetSyntheticDocumentContainer(false); - } + if (BrowsingContext* bc = GetBrowsingContext()) { + if (bc->GetSyntheticDocumentContainer()) { + Unused << bc->SetSyntheticDocumentContainer(false); } } } diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 08424e626c1e..90bdfb973ac1 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -11276,14 +11276,6 @@ nsresult nsContentUtils::AnonymizeId(nsAString& aId, return NS_OK; } -/* static */ -bool nsContentUtils::ShouldHideObjectOrEmbedImageDocument() { - return StaticPrefs:: - browser_opaqueResponseBlocking_syntheticBrowsingContext_AtStartup() && - StaticPrefs:: - browser_opaqueResponseBlocking_syntheticBrowsingContext_filter_AtStartup_DoNotUseDirectly(); -} - void nsContentUtils::RequestGeckoTaskBurst() { nsCOMPtr appShell = do_GetService(NS_APPSHELL_CID); if (appShell) { diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index e82b928f3b71..8295d51d6472 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -3382,12 +3382,6 @@ class nsContentUtils { static nsresult AnonymizeId(nsAString& aId, const nsACString& aOriginKey, OriginFormat aFormat = OriginFormat::Base64); - /** - * Return true if we should hide the synthetic browsing context for - * or images in synthetic documents. - */ - static bool ShouldHideObjectOrEmbedImageDocument(); - /** * Create and load the string bundle for the 'aFile'. * This API is used to preload the string bundle on the main thread so later diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 89f9d460ee2b..7bc87ff95eeb 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -1768,16 +1768,6 @@ value: true mirror: once -# When this pref is enabled, and elements will filter the -# browsing contexts created for the synthetic browsing contexts for the -# synthetic documents when browser.opaqueResponseBlocking.syntheticBrowsingContext -# is enabled from `Window.frames`, `Window.length` and named targeting. -- name: browser.opaqueResponseBlocking.syntheticBrowsingContext.filter - type: bool - value: true - mirror: once - do_not_use_directly: true - # When true, zooming will be enabled on all sites, even ones that declare # user-scalable=no. - name: browser.ui.zoom.force-user-scalable