Backed out changeset 21a926a8dffc (bug 1096013) for eslint failure at browser/components/sessionstore/SessionStore.jsm:2600:11. r=backout

This commit is contained in:
Sebastian Hengst 2017-03-24 17:17:50 +01:00
Родитель d05ae51211
Коммит 3ee0d8a59f
2 изменённых файлов: 22 добавлений и 59 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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 <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.
*
* @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) {
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);