Bug 1364516 - Move gCustomizeMode.setTab call out of updateTabLabelAndIcon. r=mikedeboer
While setTab does end up setting the label and icon, it also does completely different and more crucial things. This call really doesn't belong in updateTabLabelAndIcon.
MozReview-Commit-ID: 1ZSY17ThNx
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -2613,27 +2613,29 @@ var SessionStoreInternal = {
}
// Neither a tab nor a window was found, return undefined and let the caller decide what to do about it.
return undefined;
},
/**
* Updates the label and icon for a <xul:tab> 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.
+ * tabData.
*
* @param tab
* The <xul:tab> 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) {
+ if (tab.hasAttribute("customizemode")) {
+ return;
+ }
+
let browser = tab.linkedBrowser;
let win = browser.ownerGlobal;
if (!tabData) {
tabData = TabState.collect(tab);
if (!tabData) {
throw new Error("tabData not found for given tab");
}
@@ -2643,18 +2645,16 @@ var SessionStoreInternal = {
// If the page has a title, set it.
if (activePageData) {
if (activePageData.title) {
win.gBrowser.setInitialTabTitle(tab, activePageData.title);
} else if (activePageData.url != "about:blank") {
win.gBrowser.setInitialTabTitle(tab, 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 });
@@ -3687,16 +3687,20 @@ var SessionStoreInternal = {
tab.__SS_lazyData = {
url,
title,
userTypedValue: tabData.userTypedValue || "",
userTypedClear: tabData.userTypedClear || 0
};
}
+ if (tab.hasAttribute("customizemode")) {
+ window.gCustomizeMode.setTab(tab);
+ }
+
// Update tab label and icon to show something
// while we wait for the messages to be processed.
this.updateTabLabelAndIcon(tab, tabData);
// Decrease the busy state counter after we're done.
this._setWindowStateReady(window);
},