diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 177d23eef743..8217598084d5 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -799,14 +799,10 @@ } } - // Don't clear the favicon if this tab is in the pending - // state, as SessionStore will have set the icon for us even - // though we're pointed at an about:blank. Also don't clear it - // if onLocationChange was triggered by a pushState or a - // replaceState (bug 550565) or a hash change (bug 408415). - if (!this.mTab.hasAttribute("pending") && - aWebProgress.isLoadingDocument && - !isSameDocument) { + // Don't clear the favicon if this onLocationChange was + // triggered by a pushState or a replaceState (bug 550565) or + // a hash change (bug 408415). + if (aWebProgress.isLoadingDocument && !isSameDocument) { this.mBrowser.mIconURL = null; } diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index a351fa53ae44..e2cf768ef5eb 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -897,8 +897,24 @@ var SessionStoreInternal = { browser.userTypedValue = uri; } - // Update tab label and icon again after the tab history was updated. - this.updateTabLabelAndIcon(tab, tabData); + // If the page has a title, set it. + if (activePageData) { + if (activePageData.title) { + tab.label = activePageData.title; + } else if (activePageData.url != "about:blank") { + tab.label = activePageData.url; + } + } else if (tab.hasAttribute("customizemode")) { + win.gCustomizeMode.setTab(tab); + } + + // Restore the tab icon. + if ("image" in tabData) { + // Use the serialized contentPrincipal with the new icon load. + let loadingPrincipal = Utils.deserializePrincipal(tabData.iconLoadingPrincipal); + win.gBrowser.setIcon(tab, tabData.image, loadingPrincipal); + TabStateCache.update(browser, { image: null, iconLoadingPrincipal: null }); + } let event = win.document.createEvent("Events"); event.initEvent("SSTabRestoring", true, false); @@ -2580,51 +2596,6 @@ var SessionStoreInternal = { return undefined; }, - /** - * Updates the label and icon for a using the data from - * tabData. If the tab being updated happens to be the - * customization mode tab, this function will tell the window's - * CustomizeMode instance about it. - * - * @param tab - * The to update. - * @param tabData (optional) - * The tabData to use to update the tab. If the argument is - * not supplied, the data will be retrieved from the cache. - */ - updateTabLabelAndIcon(tab, tabData = null) { - let browser = tab.linkedBrowser; - let win = browser.ownerGlobal; - - if (!tabData) { - let tabData = TabState.collect(tab); - if (!tabData) { - throw new Error("tabData not found for given tab"); - } - } - - let activePageData = tabData.entries[tabData.index - 1] || null; - - // If the page has a title, set it. - if (activePageData) { - if (activePageData.title) { - tab.label = activePageData.title; - } else if (activePageData.url != "about:blank") { - tab.label = activePageData.url; - } - } else if (tab.hasAttribute("customizemode")) { - win.gCustomizeMode.setTab(tab); - } - - // Restore the tab icon. - if ("image" in tabData) { - // Use the serialized contentPrincipal with the new icon load. - let loadingPrincipal = Utils.deserializePrincipal(tabData.iconLoadingPrincipal); - win.gBrowser.setIcon(tab, tabData.image, loadingPrincipal); - TabStateCache.update(browser, { image: null, iconLoadingPrincipal: null }); - } - }, - /** * Restores the session state stored in LastSession. This will attempt * to merge data into the current session. If a window was opened at startup @@ -3624,10 +3595,6 @@ var SessionStoreInternal = { browser.messageManager.sendAsyncMessage("SessionStore:restoreHistory", {tabData, epoch, loadArguments}); - // Update tab label and icon to show something - // while we wait for the messages to be processed. - this.updateTabLabelAndIcon(tab, tabData); - // Restore tab attributes. if ("attributes" in tabData) { TabAttributes.set(tab, tabData.attributes);