Bug 1375833 - Part 1: Do not clear subframe history on normal reload. r?smaug draft
authorSamael Wang <freesamael@gmail.com>
Fri, 11 Aug 2017 14:47:20 +0800
changeset 645843 f61e349010e39b9a0741ffc68206d59a5237619e
parent 645674 3bfcbdf5c6c381d5a8febb5c209e27a69fb89f9b
child 645844 0b5fa59ef4b1a8ce4bc27ef1687ef1adbe83457a
push id73909
push userbmo:sawang@mozilla.com
push dateMon, 14 Aug 2017 10:45:52 +0000
reviewerssmaug
bugs1375833, 1326251
milestone57.0a1
Bug 1375833 - Part 1: Do not clear subframe history on normal reload. r?smaug In bug 1326251 we made gecko aggressively clear frame history. It turns out to be too aggressive comparing to all other major browsers. This patch reverses the behavior, so that only force reload and fresh would clear frame history, but not normal reload. MozReview-Commit-ID: EYVaA13cp6b
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -11903,22 +11903,26 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsICh
     // If we already have a loading history entry, store the new cache key
     // in it.  Otherwise, since we're doing a reload and won't be updating
     // our history entry, store the cache key in our current history entry.
     if (mLSHE) {
       mLSHE->SetCacheKey(cacheKey);
     } else if (mOSHE) {
       mOSHE->SetCacheKey(cacheKey);
     }
-  }
-
-  // Clear subframe history on refresh or reload.
+
+    // Since we're force-reloading, clear all the sub frame history.
+    ClearFrameHistory(mLSHE);
+    ClearFrameHistory(mOSHE);
+  }
+
+  // Clear subframe history on refresh.
   // XXX: history.go(0) won't go this path as aLoadType is LOAD_HISTORY in this
   // case. One should re-validate after bug 1331865 fixed.
-  if (aLoadType == LOAD_REFRESH || (aLoadType & LOAD_CMD_RELOAD)) {
+  if (aLoadType == LOAD_REFRESH) {
     ClearFrameHistory(mLSHE);
     ClearFrameHistory(mOSHE);
   }
 
   if (updateSHistory) {
     // Update session history if necessary...
     if (!mLSHE && (mItemType == typeContent) && mURIResultedInDocument) {
       /* This is  a fresh page getting loaded for the first time