зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1422903 - Prevent about:privatebrowsing favicon from flickering. r=florian
We apply a custom workaround to show about:home and about:newtab favicons as early as possible for perceived performance, but didn't previously consider the about:privatebrowsing page (which can act as both about:home and about:newtab). MozReview-Commit-ID: gPiV08h0j0 --HG-- extra : rebase_source : 12a6ed0973013ed68e783ca3d39a9492c5185411
This commit is contained in:
Родитель
e38e4387e3
Коммит
9006d66671
|
@ -1346,6 +1346,8 @@ var gBrowserInit = {
|
|||
this._uriToLoadPromise.then(uriToLoad => {
|
||||
if (uriToLoad == "about:home") {
|
||||
gBrowser.setIcon(gBrowser.selectedTab, "chrome://branding/content/icon32.png");
|
||||
} else if (uriToLoad == "about:privatebrowsing") {
|
||||
gBrowser.setIcon(gBrowser.selectedTab, "chrome://browser/skin/privatebrowsing/favicon.svg");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -801,7 +801,16 @@
|
|||
|
||||
// Ignore initial about:blank to prevent flickering.
|
||||
if (!this.mBrowser.mIconURL && !ignoreBlank) {
|
||||
this.mTabBrowser.useDefaultIcon(this.mTab);
|
||||
// Don't switch to the default icon on about:home or about:newtab,
|
||||
// since these pages get their favicon set in browser code to
|
||||
// improve perceived performance.
|
||||
let isNewTab = originalLocation &&
|
||||
(originalLocation.spec == "about:newtab" ||
|
||||
originalLocation.spec == "about:privatebrowsing" ||
|
||||
originalLocation.spec == "about:home");
|
||||
if (!isNewTab) {
|
||||
this.mTabBrowser.useDefaultIcon(this.mTab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2813,8 +2822,10 @@
|
|||
|
||||
// Hack to ensure that the about:newtab favicon is loaded
|
||||
// instantaneously, to avoid flickering and improve perceived performance.
|
||||
if (aURI == BROWSER_NEW_TAB_URL) {
|
||||
if (aURI == "about:newtab") {
|
||||
this.setIcon(t, "chrome://branding/content/icon32.png");
|
||||
} else if (aURI == "about:privatebrowsing") {
|
||||
this.setIcon(t, "chrome://browser/skin/privatebrowsing/favicon.svg");
|
||||
}
|
||||
|
||||
// Dispatch a new tab notification. We do this once we're
|
||||
|
|
|
@ -9,7 +9,6 @@ Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
|||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const FAVICON_QUESTION = "chrome://global/skin/icons/question-32.png";
|
||||
const FAVICON_PRIVACY = "chrome://browser/skin/privatebrowsing/favicon.svg";
|
||||
|
||||
var stringBundle = Services.strings.createBundle(
|
||||
"chrome://browser/locale/aboutPrivateBrowsing.properties");
|
||||
|
@ -38,10 +37,6 @@ var prefObserver = {
|
|||
prefBranch.addObserver("pbmode.enabled", prefObserver, true);
|
||||
prefBranch.addObserver("enabled", prefObserver, true);
|
||||
|
||||
function setFavIcon(url) {
|
||||
document.getElementById("favicon").setAttribute("href", url);
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
if (!PrivateBrowsingUtils.isContentWindowPrivate(window)) {
|
||||
document.documentElement.classList.remove("private");
|
||||
|
@ -60,8 +55,6 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
});
|
||||
|
||||
document.title = stringBundle.GetStringFromName("title.head");
|
||||
document.getElementById("favicon")
|
||||
.setAttribute("href", FAVICON_PRIVACY);
|
||||
tpToggle.addEventListener("change", toggleTrackingProtection);
|
||||
document.getElementById("startTour")
|
||||
.addEventListener("click", dontShowIntroPanelAgain);
|
||||
|
|
Загрузка…
Ссылка в новой задаче