Bug 1176019 - Clear cached layers on location change r?mconley draft
authorDoug Thayer <dothayer@mozilla.com>
Tue, 15 May 2018 09:29:16 -0700
changeset 797879 72125d5d399da91ca48d7f02e109d3a28a9161e9
parent 797878 a7f61dc64a71250f448f8d7e1f8e6c28a71c88a9
child 797880 8a51c1473ef48b2cad410b156e4b8acf80cc6d68
push id110615
push userbmo:dothayer@mozilla.com
push dateMon, 21 May 2018 22:41:06 +0000
reviewersmconley
bugs1176019
milestone62.0a1
Bug 1176019 - Clear cached layers on location change r?mconley To avoid a flash of stale content in the event of a slow tab switch, we need to make sure we remove a tab from the cache if its location changes while it's in the background. MozReview-Commit-ID: ElpoWhhjb0n
browser/base/content/tabbrowser.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -4668,16 +4668,24 @@ class TabProgressListener {
       // Tabs in private windows aren't registered as "Open" so
       // that they don't appear as switch-to-tab candidates.
       if (!isBlankPageURL(aLocation.spec) &&
           (!PrivateBrowsingUtils.isWindowPrivate(window) ||
             PrivateBrowsingUtils.permanentPrivateBrowsing)) {
         gBrowser._unifiedComplete.registerOpenPage(aLocation, userContextId);
         this.mBrowser.registeredOpenURI = aLocation;
       }
+
+      if (this.mTab != gBrowser.selectedTab) {
+        let tabCacheIndex = gBrowser._tabLayerCache.indexOf(this.mTab);
+        if (tabCacheIndex != -1) {
+          gBrowser._tabLayerCache.splice(tabCacheIndex, 1);
+          gBrowser._getSwitcher().cleanUpTabAfterEviction(this.mTab);
+        }
+      }
     }
 
     if (!this.mBlank) {
       this._callProgressListeners("onLocationChange",
                                   [aWebProgress, aRequest, aLocation, aFlags]);
     }
 
     if (topLevel) {