diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index 385d7f367c2e..fbf4aee1749c 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -331,8 +331,13 @@ void CanonicalBrowsingContext::ReplacedBy( txn.SetDisplayMode(GetDisplayMode()); txn.SetForceDesktopViewport(GetForceDesktopViewport()); txn.SetIsUnderHiddenEmbedderElement(GetIsUnderHiddenEmbedderElement()); - txn.SetFullZoom(GetFullZoom()); - txn.SetTextZoom(GetTextZoom()); + + // When using site-specific zoom, we let the front-end manage it, otherwise it + // can cause weirdness like bug 1846141. + if (!StaticPrefs::browser_zoom_siteSpecific()) { + txn.SetFullZoom(GetFullZoom()); + txn.SetTextZoom(GetTextZoom()); + } // Propagate the default load flags so that the TRR mode flags are forwarded // to the new browsing context. See bug 1828643. diff --git a/layout/base/tests/test_zoom_restore_bfcache.html b/layout/base/tests/test_zoom_restore_bfcache.html index f4654d4b1bb2..d1133a9b044b 100644 --- a/layout/base/tests/test_zoom_restore_bfcache.html +++ b/layout/base/tests/test_zoom_restore_bfcache.html @@ -120,8 +120,8 @@ function handlePageShow(persisted) { } } -// If Fission is disabled, the pref is no-op. -SpecialPowers.pushPrefEnv({set: [["fission.bfcacheInParent", true]]}, () => { +// We want to test Gecko's zoom handling, not the front-end's. +SpecialPowers.pushPrefEnv({set: [["browser.zoom.siteSpecific", false]]}, () => { window.open('file_zoom_restore_bfcache.html', '_blank', 'noopener'); });