Bug 1758664, don't try to recheck possible session history entry in the parent process if we're doing such check already, r=peterv
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 10 Mar 2022 10:19:57 +0000
changeset 610210 966d676908b33872a19cc58ca3737443e09985bf
parent 610209 2155ccd6f6b47558e80983803d684687dbbc2ddc
child 610211 b7b1979c79854c39911bc54a69aeeb60bf9ea7aa
push id159139
push useropettay@mozilla.com
push dateThu, 10 Mar 2022 10:22:19 +0000
treeherderautoland@966d676908b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1758664
milestone100.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1758664, don't try to recheck possible session history entry in the parent process if we're doing such check already, r=peterv The code which this patch removes was clearly an oversight in the regressing patch. Differential Revision: https://phabricator.services.mozilla.com/D140690
docshell/base/nsDocShell.cpp
docshell/test/navigation/file_bug1758664.html
docshell/test/navigation/mochitest.ini
docshell/test/navigation/test_bug1758664.html
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -786,21 +786,16 @@ nsresult nsDocShell::LoadURI(nsDocShellL
   // 1492648. LoadType should now be set up by the caller at the time they
   // create their nsDocShellLoadState object to pass into LoadURI.
 
   MOZ_LOG(
       gDocShellLeakLog, LogLevel::Debug,
       ("nsDocShell[%p]: loading %s with flags 0x%08x", this,
        aLoadState->URI()->GetSpecOrDefault().get(), aLoadState->LoadFlags()));
 
-  // Always clear mCheckingSessionHistory. MaybeHandleSubframeHistory uses it
-  // internally when querying session history information from the parent
-  // process.
-  mCheckingSessionHistory = false;
-
   if ((!aLoadState->LoadIsFromSessionHistory() &&
        !LOAD_TYPE_HAS_FLAGS(aLoadState->LoadType(),
                             LOAD_FLAGS_REPLACE_HISTORY)) ||
       aContinueHandlingSubframeHistory) {
     // This is possibly a subframe, so handle it accordingly.
     //
     // If history exists, it will be loaded into the aLoadState object, and the
     // LoadType will be changed.
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_bug1758664.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+var onIframeOnload = function() {
+    var iframe = window.document.getElementById('applicationIframe');
+    opener.is(iframe.contentWindow.location.search, "?iframe", "Should have loaded the iframe");
+    window.close();
+    opener.SimpleTest.finish();
+}
+
+var onPageOnload = function() {
+    if (location.search == "?iframe") {
+      return;
+    }
+    if(!window.name) {
+        window.name = 'file_bug1758664.html';
+        window.location.reload();
+        return;
+    }
+    var iframe = window.document.getElementById('applicationIframe');
+    iframe.addEventListener('load', onIframeOnload);
+    iframe.src = "file_bug1758664.html?iframe";
+}
+window.document.addEventListener("DOMContentLoaded", onPageOnload);
+
+</script>
+</head>
+<body>
+    <iframe id="applicationIframe"></iframe>
+</body>
+</html>
--- a/docshell/test/navigation/mochitest.ini
+++ b/docshell/test/navigation/mochitest.ini
@@ -101,16 +101,19 @@ skip-if = fission # The test is currentl
 [test_bug1745638.html]
 support-files = file_bug1745638.html
 [test_bug1747019.html]
 support-files =
   goback.html
   cache_control_max_age_3600.sjs
 [test_bug1750973.html]
 support-files = file_bug1750973.html
+[test_bug1758664.html]
+support-files = file_bug1758664.html
+skip-if = !sessionHistoryInParent # the old implementation behaves inconsistently
 [test_bug270414.html]
 [test_bug278916.html]
 [test_bug279495.html]
 [test_bug344861.html]
 skip-if = toolkit == "android"
 [test_bug386782.html]
 [test_bug430624.html]
 [test_bug430723.html]
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/test_bug1758664.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Bug 1758664</title>
+  <script src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+  <script>
+    SimpleTest.waitForExplicitFinish();
+
+    function test() {
+      window.open("file_bug1758664.html");
+    }
+  </script>
+</head>
+<body onload="test()">
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+</body>
+</html>