mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 836010 - When startup is determined to be slow, tell users about ways to improve their startup time. r=felipe
This commit is contained in:
parent
8882de4cdf
commit
35629f6f28
@ -234,6 +234,10 @@ pref("browser.shell.checkDefaultBrowser", true);
|
||||
pref("browser.startup.page", 1);
|
||||
pref("browser.startup.homepage", "chrome://branding/locale/browserconfig.properties");
|
||||
|
||||
pref("browser.slowStartup.notificationDisabled", false);
|
||||
pref("browser.slowStartup.timeThreshold", 60000);
|
||||
pref("browser.slowStartup.maxSamples", 5);
|
||||
|
||||
// This url, if changed, MUST continue to point to an https url. Pulling arbitrary content to inject into
|
||||
// this page over http opens us up to a man-in-the-middle attack that we'd rather not face. If you are a downstream
|
||||
// repackager of this code using an alternate snippet url, please keep your users safe
|
||||
|
@ -1149,6 +1149,7 @@
|
||||
</hbox>
|
||||
|
||||
<vbox id="browser-bottombox" layer="true">
|
||||
<notificationbox id="global-notificationbox"/>
|
||||
<toolbar id="developer-toolbar"
|
||||
class="devtools-toolbar"
|
||||
hidden="true">
|
||||
|
@ -406,6 +406,64 @@ BrowserGlue.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_trackSlowStartup: function () {
|
||||
if (Services.prefs.getBoolPref("browser.slowStartup.notificationDisabled"))
|
||||
return;
|
||||
|
||||
let currentTime = Date.now() - Services.startup.getStartupInfo().process;
|
||||
let averageTime = 0;
|
||||
let samples = 0;
|
||||
try {
|
||||
averageTime = Services.prefs.getIntPref("browser.slowStartup.averageTime");
|
||||
samples = Services.prefs.getIntPref("browser.slowStartup.samples");
|
||||
} catch (e) { }
|
||||
|
||||
averageTime = (averageTime * samples + currentTime) / ++samples;
|
||||
|
||||
if (samples >= Services.prefs.getIntPref("browser.slowStartup.maxSamples")) {
|
||||
if (averageTime > Services.prefs.getIntPref("browser.slowStartup.timeThreshold"))
|
||||
this._showSlowStartupNotification();
|
||||
averageTime = 0;
|
||||
samples = 0;
|
||||
}
|
||||
|
||||
Services.prefs.setIntPref("browser.slowStartup.averageTime", averageTime);
|
||||
Services.prefs.setIntPref("browser.slowStartup.samples", samples);
|
||||
},
|
||||
|
||||
_showSlowStartupNotification: function () {
|
||||
let win = this.getMostRecentBrowserWindow();
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
let productName = Services.strings
|
||||
.createBundle("chrome://branding/locale/brand.properties")
|
||||
.GetStringFromName("brandFullName");
|
||||
let message = win.gNavigatorBundle.getFormattedString("slowStartup.message", [productName]);
|
||||
|
||||
let buttons = [
|
||||
{
|
||||
label: win.gNavigatorBundle.getString("slowStartup.helpButton.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("slowStartup.helpButton.accesskey"),
|
||||
callback: function () {
|
||||
win.openUILinkIn("https://support.mozilla.org/kb/firefox-takes-long-time-start-up", "tab");
|
||||
}
|
||||
},
|
||||
{
|
||||
label: win.gNavigatorBundle.getString("slowStartup.disableNotificationButton.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("slowStartup.disableNotificationButton.accesskey"),
|
||||
callback: function () {
|
||||
Services.prefs.setBoolPref("browser.slowStartup.notificationDisabled", true);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
let nb = win.document.getElementById("global-notificationbox");
|
||||
nb.appendNotification(message, "slow-startup",
|
||||
"chrome://browser/skin/slowStartup-16.png",
|
||||
nb.PRIORITY_INFO_LOW, buttons);
|
||||
},
|
||||
|
||||
// the first browser window has finished initializing
|
||||
_onFirstWindowLoaded: function BG__onFirstWindowLoaded() {
|
||||
#ifdef XP_WIN
|
||||
@ -418,6 +476,8 @@ BrowserGlue.prototype = {
|
||||
temp.WinTaskbarJumpList.startup();
|
||||
}
|
||||
#endif
|
||||
|
||||
this._trackSlowStartup();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -443,3 +443,10 @@ mixedContentBlocked.keepBlockingButton.label = Keep Blocking
|
||||
mixedContentBlocked.keepBlockingButton.accesskey = B
|
||||
mixedContentBlocked.unblock.label = Disable Protection on This Page
|
||||
mixedContentBlocked.unblock.accesskey = D
|
||||
|
||||
# LOCALIZATION NOTE - %S is brandShortName
|
||||
slowStartup.message = %S seems slow… to… start.
|
||||
slowStartup.helpButton.label = Learn How to Speed It Up
|
||||
slowStartup.helpButton.accesskey = L
|
||||
slowStartup.disableNotificationButton.label = Don't Tell Me Again
|
||||
slowStartup.disableNotificationButton.accesskey = A
|
||||
|
@ -19,6 +19,7 @@ browser.jar:
|
||||
#endif
|
||||
skin/classic/browser/actionicon-tab.png
|
||||
* skin/classic/browser/browser.css
|
||||
skin/classic/browser/click-to-play-warning-stripes.png
|
||||
* skin/classic/browser/engineManager.css
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
skin/classic/browser/Geolocation-64.png
|
||||
@ -43,7 +44,7 @@ browser.jar:
|
||||
skin/classic/browser/Secure.png
|
||||
skin/classic/browser/Security-broken.png
|
||||
skin/classic/browser/setDesktopBackground.css
|
||||
skin/classic/browser/click-to-play-warning-stripes.png
|
||||
skin/classic/browser/slowStartup-16.png
|
||||
skin/classic/browser/Toolbar.png
|
||||
skin/classic/browser/Toolbar-small.png
|
||||
skin/classic/browser/urlbar-arrow.png
|
||||
|
BIN
browser/themes/gnomestripe/slowStartup-16.png
Normal file
BIN
browser/themes/gnomestripe/slowStartup-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 478 B |
@ -19,6 +19,7 @@ browser.jar:
|
||||
skin/classic/browser/actionicon-tab.png
|
||||
skin/classic/browser/actionicon-tab@2x.png
|
||||
* skin/classic/browser/browser.css (browser.css)
|
||||
skin/classic/browser/click-to-play-warning-stripes.png
|
||||
* skin/classic/browser/engineManager.css (engineManager.css)
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
skin/classic/browser/Geolocation-16@2x.png
|
||||
@ -36,6 +37,7 @@ browser.jar:
|
||||
skin/classic/browser/identity-icons-https-mixed-active.png
|
||||
skin/classic/browser/identity-icons-https-mixed-active@2x.png
|
||||
skin/classic/browser/Info.png
|
||||
skin/classic/browser/keyhole-circle.png
|
||||
skin/classic/browser/KUI-background.png
|
||||
skin/classic/browser/KUI-close.png
|
||||
skin/classic/browser/menu-back.png
|
||||
@ -65,8 +67,7 @@ browser.jar:
|
||||
skin/classic/browser/Search@2x.png
|
||||
skin/classic/browser/Secure-Glyph.png
|
||||
skin/classic/browser/Secure-Glyph@2x.png
|
||||
skin/classic/browser/click-to-play-warning-stripes.png
|
||||
skin/classic/browser/keyhole-circle.png
|
||||
skin/classic/browser/slowStartup-16.png
|
||||
skin/classic/browser/Toolbar.png
|
||||
skin/classic/browser/toolbarbutton-dropmarker.png
|
||||
skin/classic/browser/urlbar-history-dropmarker.png
|
||||
|
BIN
browser/themes/pinstripe/slowStartup-16.png
Normal file
BIN
browser/themes/pinstripe/slowStartup-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 499 B |
@ -23,6 +23,7 @@ browser.jar:
|
||||
skin/classic/browser/appmenu-icons.png
|
||||
skin/classic/browser/appmenu-dropmarker.png
|
||||
* skin/classic/browser/browser.css
|
||||
skin/classic/browser/click-to-play-warning-stripes.png
|
||||
* skin/classic/browser/engineManager.css
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
skin/classic/browser/Geolocation-64.png
|
||||
@ -53,7 +54,7 @@ browser.jar:
|
||||
skin/classic/browser/searchbar-dropdown-arrow.png
|
||||
skin/classic/browser/Secure24.png
|
||||
skin/classic/browser/setDesktopBackground.css
|
||||
skin/classic/browser/click-to-play-warning-stripes.png
|
||||
skin/classic/browser/slowStartup-16.png
|
||||
skin/classic/browser/Toolbar.png
|
||||
skin/classic/browser/Toolbar-inverted.png
|
||||
skin/classic/browser/toolbarbutton-dropdown-arrow.png
|
||||
@ -251,6 +252,7 @@ browser.jar:
|
||||
skin/classic/aero/browser/appmenu-dropmarker.png
|
||||
skin/classic/aero/browser/appmenu-icons.png
|
||||
* skin/classic/aero/browser/browser.css (browser-aero.css)
|
||||
skin/classic/aero/browser/click-to-play-warning-stripes.png
|
||||
* skin/classic/aero/browser/engineManager.css
|
||||
skin/classic/aero/browser/Geolocation-16.png
|
||||
skin/classic/aero/browser/Geolocation-64.png
|
||||
@ -281,7 +283,7 @@ browser.jar:
|
||||
skin/classic/aero/browser/searchbar-dropdown-arrow.png (searchbar-dropdown-arrow-aero.png)
|
||||
skin/classic/aero/browser/Secure24.png (Secure24-aero.png)
|
||||
skin/classic/aero/browser/setDesktopBackground.css
|
||||
skin/classic/aero/browser/click-to-play-warning-stripes.png
|
||||
skin/classic/aero/browser/slowStartup-16.png
|
||||
skin/classic/aero/browser/Toolbar.png
|
||||
skin/classic/aero/browser/Toolbar-inverted.png
|
||||
skin/classic/aero/browser/toolbarbutton-dropdown-arrow.png
|
||||
|
BIN
browser/themes/winstripe/slowStartup-16.png
Normal file
BIN
browser/themes/winstripe/slowStartup-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 512 B |
Loading…
Reference in New Issue
Block a user