From c9a9de8c488d42f569487f72efe29c96f9d68697 Mon Sep 17 00:00:00 2001 From: Doug Thayer Date: Tue, 15 May 2018 09:29:16 -0700 Subject: [PATCH] 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 --HG-- extra : rebase_source : 615ebd1a57916e0fe2b8c062ab47ffe748397033 --- browser/base/content/tabbrowser.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 5493526e0660..23567f0817be 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -4673,6 +4673,14 @@ class TabProgressListener { 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) {