Bug 1133003 part B - count Flash hangs and show UI if there is more than one in a session. This feature can be disabled at runtime by setting browser.flash-protected-mode-flip.enable. r=jaws

--HG--
extra : rebase_source : 02067f7252ad2c112e445548399866dba27c8c6b
extra : histedit_source : 2c48949b63ef5a9484c6a5d005558037a14e6c5d
This commit is contained in:
Benjamin Smedberg 2015-02-19 17:43:24 -05:00
Родитель 0510928e0d
Коммит f5675dad59
3 изменённых файлов: 61 добавлений и 0 удалений

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

@ -1168,6 +1168,12 @@ pref("toolbar.customization.usesheet", false);
// Disable Flash protected mode to reduce hang/crash rates.
pref("dom.ipc.plugins.flash.disable-protected-mode", true);
// Feature-disable the protected-mode auto-flip
pref("browser.flash-protected-mode-flip.enable", true);
// Whether we've already flipped protected mode automatically
pref("browser.flash-protected-mode-flip.done", false);
#ifdef XP_MACOSX
// On mac, the default pref is per-architecture
pref("dom.ipc.plugins.enabled.i386", true);

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

@ -476,7 +476,11 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("privacy.trackingprotection.ui.enabled");
}
}
break;
#endif
case "flash-plugin-hang":
this._handleFlashHang();
break;
}
},
@ -524,6 +528,9 @@ BrowserGlue.prototype = {
os.addObserver(this, "browser-search-engine-modified", false);
os.addObserver(this, "browser-search-service", false);
os.addObserver(this, "restart-in-safe-mode", false);
os.addObserver(this, "flash-plugin-hang", false);
this._flashHangCount = 0;
},
// cleanup (called on application shutdown)
@ -568,6 +575,7 @@ BrowserGlue.prototype = {
#ifdef NIGHTLY_BUILD
Services.prefs.removeObserver(POLARIS_ENABLED, this);
#endif
os.removeObserver(this, "flash-plugin-hang");
},
_onAppDefaults: function BG__onAppDefaults() {
@ -2086,6 +2094,49 @@ BrowserGlue.prototype = {
},
#endif
_handleFlashHang: function() {
++this._flashHangCount;
if (this._flashHangCount < 2) {
return;
}
// protected mode only applies to win32
if (Services.appinfo.XPCOMABI != "x86-msvc") {
return;
}
if (Services.prefs.getBoolPref("dom.ipc.plugins.flash.disable-protected-mode")) {
return;
}
if (!Services.prefs.getBoolPref("browser.flash-protected-mode-flip.enable")) {
return;
}
if (Services.prefs.getBoolPref("browser.flash-protected-mode-flip.done")) {
return;
}
Services.prefs.setBoolPref("dom.ipc.plugins.flash.disable-protected-mode", true);
Services.prefs.setBoolPref("browser.flash-protected-mode-flip.done", true);
let win = this.getMostRecentBrowserWindow();
if (!win) {
return;
}
let productName = Services.strings
.createBundle("chrome://branding/locale/brand.properties")
.GetStringFromName("brandShortName");
let message = win.gNavigatorBundle.
getFormattedString("flashHang.message", [productName]);
let buttons = [{
label: win.gNavigatorBundle.getString("flashHang.helpButton.label"),
accessKey: win.gNavigatorBundle.getString("flashHang.helpButton.accesskey"),
callback: function() {
win.openUILinkIn("https://support.mozilla.org/kb/flash-protected-mode-autodisabled", "tab");
}
}];
let nb = win.document.getElementById("global-notificationbox");
nb.appendNotification(message, "flash-hang", null,
nb.PRIORITY_INFO_MEDIUM, buttons);
},
// for XPCOM
classID: Components.ID("{eab9012e-5f74-4cbc-b2b5-a590235513cc}"),

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

@ -626,6 +626,10 @@ slowStartup.helpButton.accesskey = L
slowStartup.disableNotificationButton.label = Don't Tell Me Again
slowStartup.disableNotificationButton.accesskey = A
# LOCALIZATION NOTE - %S is brandShortName
flashHang.message = %S changed some Adobe Flash settings improve performance.
flashHang.helpButton.label = Learn More…
flashHang.helpButton.accesskey = L
# LOCALIZATION NOTE(customizeTips.tip0): %1$S will be replaced with the text defined
# in customizeTips.tip0.hint, %2$S will be replaced with brandShortName, %3$S will