diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 8025adb2d19f..492246ef394b 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -2910,21 +2910,12 @@ void BrowsingContext::DidSet(FieldIndex) { nsDocShell::Cast(mDocShell)->MaybeDisconnectChildListenersOnPageHide(); } - if (isInBFCache) { - PreOrderWalk([&](BrowsingContext* aContext) { - nsCOMPtr shell = aContext->GetDocShell(); - if (shell) { - nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(false); - } - }); - } else { - PostOrderWalk([&](BrowsingContext* aContext) { - nsCOMPtr shell = aContext->GetDocShell(); - if (shell) { - nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(true); - } - }); - } + PreOrderWalk([&](BrowsingContext* aContext) { + nsCOMPtr shell = aContext->GetDocShell(); + if (shell) { + nsDocShell::Cast(shell)->FirePageHideShowNonRecursive(!isInBFCache); + } + }); if (isInBFCache) { PreOrderWalk([&](BrowsingContext* aContext) { diff --git a/docshell/test/browser/browser_browsingContext-webProgress.js b/docshell/test/browser/browser_browsingContext-webProgress.js index 518c36389a94..713d6b541579 100644 --- a/docshell/test/browser/browser_browsingContext-webProgress.js +++ b/docshell/test/browser/browser_browsingContext-webProgress.js @@ -154,7 +154,7 @@ add_task(async function() { is(request.URI.spec, secondLocation); } - const onBackLocationChanged = waitForNextLocationChange(webProgress, true); + const onBackLocationChanged = waitForNextLocationChange(webProgress); const onBackDocumentStart = waitForNextDocumentStart(webProgress); browser.goBack(); @@ -190,7 +190,7 @@ add_task(async function() { BrowserTestUtils.removeTab(tab); }); -function waitForNextLocationChange(webProgress, onlyTopLevel = false) { +function waitForNextLocationChange(webProgress) { return new Promise(resolve => { const wpl = { QueryInterface: ChromeUtils.generateQI([ @@ -198,10 +198,6 @@ function waitForNextLocationChange(webProgress, onlyTopLevel = false) { "nsISupportsWeakReference", ]), onLocationChange(progress, request, location, flags) { - if (onlyTopLevel && progress.browsingContext.parent) { - // Ignore non-toplevel. - return; - } webProgress.removeProgressListener(wpl, Ci.nsIWebProgress.NOTIFY_ALL); resolve({ browsingContext: progress.browsingContext, diff --git a/docshell/test/mochitest/file_bug1740516_1.html b/docshell/test/mochitest/file_bug1740516_1.html deleted file mode 100644 index cf3a54027bd3..000000000000 --- a/docshell/test/mochitest/file_bug1740516_1.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - diff --git a/docshell/test/mochitest/file_bug1740516_1_inner.html b/docshell/test/mochitest/file_bug1740516_1_inner.html deleted file mode 100644 index 159c6bde5aec..000000000000 --- a/docshell/test/mochitest/file_bug1740516_1_inner.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/docshell/test/mochitest/file_bug1740516_2.html b/docshell/test/mochitest/file_bug1740516_2.html deleted file mode 100644 index 2dc714feef0c..000000000000 --- a/docshell/test/mochitest/file_bug1740516_2.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/docshell/test/mochitest/mochitest.ini b/docshell/test/mochitest/mochitest.ini index c65697074052..1501867d613e 100644 --- a/docshell/test/mochitest/mochitest.ini +++ b/docshell/test/mochitest/mochitest.ini @@ -112,11 +112,6 @@ support-files = file_bug675587.html [test_bug1729662.html] support-files = file_bug1729662.html -[test_bug1740516.html] -support-files = - file_bug1740516_1.html - file_bug1740516_1_inner.html - file_bug1740516_2.html [test_close_onpagehide_by_history_back.html] [test_close_onpagehide_by_window_close.html] [test_compressed_multipart.html] diff --git a/docshell/test/mochitest/test_bug1740516.html b/docshell/test/mochitest/test_bug1740516.html deleted file mode 100644 index b54932c736ba..000000000000 --- a/docshell/test/mochitest/test_bug1740516.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - Test pageshow event order for iframe - - - - - -

- -

-
-