Backed out 3 changesets (bug 1096013) for browser_tabicon_after_bg_tab_crash.js failures

CLOSED TREE

Backed out changeset 24f52ebe6dc9 (bug 1096013)
Backed out changeset dc7d1c21c857 (bug 1096013)
Backed out changeset 28229b5ba95a (bug 1096013)
This commit is contained in:
Phil Ringnalda 2017-03-24 20:42:09 -07:00
Родитель 848bbffb60
Коммит a281450bc9
4 изменённых файлов: 23 добавлений и 101 удалений

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

@ -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) {
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
@ -3492,17 +3463,9 @@ var SessionStoreInternal = {
this._windows[aWindow.__SSi].selected = aSelectTab;
}
// If we restore the selected tab, make sure it goes first.
let selectedIndex = aTabs.indexOf(tabbrowser.selectedTab);
if (selectedIndex > -1) {
this.restoreTab(tabbrowser.selectedTab, aTabData[selectedIndex]);
}
// Restore all tabs.
for (let t = 0; t < aTabs.length; t++) {
if (t != selectedIndex) {
this.restoreTab(aTabs[t], aTabData[t]);
}
this.restoreTab(aTabs[t], aTabData[t]);
}
},
@ -3632,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);

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

@ -246,4 +246,3 @@ skip-if = !e10s # GroupedSHistory is e10s-only
[browser_closed_objects_changed_notifications_tabs.js]
[browser_closed_objects_changed_notifications_windows.js]
[browser_duplicate_history.js]
[browser_tabicon_after_bg_tab_crash.js]

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

@ -1,32 +0,0 @@
"use strict";
const FAVICON = "data:image/gif;base64,R0lGODlhCwALAIAAAAAA3pn/ZiH5BAEAAAEALAAAAAALAAsAAAIUhA+hkcuO4lmNVindo7qyrIXiGBYAOw==";
const PAGE_URL = `data:text/html,
<html>
<head>
<link rel="shortcut icon" href="${FAVICON}">
</head>
<body>
Favicon!
</body>
</html>`;
/**
* Tests that if a background tab crashes that it doesn't
* lose the favicon in the tab.
*/
add_task(function* test_tabicon_after_bg_tab_crash() {
let originalTab = gBrowser.selectedTab;
yield BrowserTestUtils.withNewTab({
gBrowser,
url: PAGE_URL,
}, function*(browser) {
Assert.equal(browser.mIconURL, FAVICON, "Favicon is correctly set.");
yield BrowserTestUtils.switchTab(gBrowser, originalTab);
yield BrowserTestUtils.crashBrowser(browser,
false /* shouldShowTabCrashPage */);
Assert.equal(browser.mIconURL, FAVICON,
"Favicon is still set after crash.");
});
});