mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 12:13:22 +00:00
Bug 1047076 - Disable e10s on Nightly if Accessibility is enabled (r=felipe)
This commit is contained in:
parent
f3779e27ad
commit
8db73fa93d
@ -2253,6 +2253,15 @@ let E10SUINotification = {
|
||||
CURRENT_NOTICE_COUNT: 0,
|
||||
|
||||
checkStatus: function() {
|
||||
let skipE10sChecks = false;
|
||||
try {
|
||||
skipE10sChecks = Services.prefs.getBoolPref("browser.tabs.remote.autostart.disabled-because-using-a11y");
|
||||
} catch(e) {}
|
||||
|
||||
if (skipE10sChecks) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Services.appinfo.browserTabsRemoteAutostart) {
|
||||
let notice = 0;
|
||||
try {
|
||||
@ -2263,13 +2272,22 @@ let E10SUINotification = {
|
||||
if (!activationNoticeShown) {
|
||||
this._showE10sActivatedNotice();
|
||||
}
|
||||
|
||||
// e10s doesn't work with accessibility, so we prompt to disable
|
||||
// e10s if a11y is enabled, now or in the future.
|
||||
Services.obs.addObserver(this, "a11y-init-or-shutdown", true);
|
||||
if (Services.appinfo.accessibilityEnabled) {
|
||||
this._showE10sAccessibilityWarning();
|
||||
}
|
||||
} else {
|
||||
let e10sPromptShownCount = 0;
|
||||
try {
|
||||
e10sPromptShownCount = Services.prefs.getIntPref("browser.displayedE10SPrompt");
|
||||
} catch(e) {}
|
||||
|
||||
if (!Services.appinfo.inSafeMode && e10sPromptShownCount < 5) {
|
||||
if (!Services.appinfo.inSafeMode &&
|
||||
!Services.appinfo.accessibilityEnabled &&
|
||||
e10sPromptShownCount < 5) {
|
||||
Services.tm.mainThread.dispatch(() => {
|
||||
try {
|
||||
this._showE10SPrompt();
|
||||
@ -2282,6 +2300,14 @@ let E10SUINotification = {
|
||||
}
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
if (topic == "a11y-init-or-shutdown" && data == "1") {
|
||||
this._showE10sAccessibilityWarning();
|
||||
}
|
||||
},
|
||||
|
||||
_showE10sActivatedNotice: function() {
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
if (!win)
|
||||
@ -2344,6 +2370,56 @@ let E10SUINotification = {
|
||||
|
||||
win.PopupNotifications.show(browser, "enable_e10s", promptMessage, null, mainAction, secondaryActions, options);
|
||||
},
|
||||
|
||||
_warnedAboutAccessibility: false,
|
||||
|
||||
_showE10sAccessibilityWarning: function() {
|
||||
Services.prefs.setBoolPref("browser.tabs.remote.autostart.disabled-because-using-a11y", true);
|
||||
|
||||
if (this._warnedAboutAccessibility) {
|
||||
return;
|
||||
}
|
||||
this._warnedAboutAccessibility = true;
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
if (!win) {
|
||||
// Just restart immediately.
|
||||
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);
|
||||
return;
|
||||
}
|
||||
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
|
||||
let promptMessage = "Multiprocess Nightly (e10s) does not yet support accessibility features. Multiprocessing will be disabled if you restart Firefox. Would you like to restart?";
|
||||
let mainAction = {
|
||||
label: "Disable and Restart",
|
||||
accessKey: "R",
|
||||
callback: function () {
|
||||
// Restart the app
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
|
||||
if (cancelQuit.data)
|
||||
return; // somebody canceled our quit request
|
||||
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);
|
||||
}
|
||||
};
|
||||
let secondaryActions = [
|
||||
{
|
||||
label: "Don't Disable",
|
||||
accessKey: "D",
|
||||
callback: function () {
|
||||
Services.prefs.setBoolPref("browser.tabs.remote.autostart.disabled-because-using-a11y", false);
|
||||
}
|
||||
}
|
||||
];
|
||||
let options = {
|
||||
popupIconURL: "chrome://browser/skin/e10s-64@2x.png",
|
||||
learnMoreURL: "https://wiki.mozilla.org/Electrolysis",
|
||||
persistWhileVisible: true
|
||||
};
|
||||
|
||||
win.PopupNotifications.show(browser, "a11y_enabled_with_e10s", promptMessage, null, mainAction, secondaryActions, options);
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -99,6 +99,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessibilityService.h"
|
||||
#endif
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
@ -828,6 +832,17 @@ nsXULAppInfo::GetBrowserTabsRemoteAutostart(bool* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetAccessibilityEnabled(bool* aResult)
|
||||
{
|
||||
#ifdef ACCESSIBILITY
|
||||
*aResult = GetAccService() != nullptr;
|
||||
#else
|
||||
*aResult = false;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::EnsureContentProcess()
|
||||
{
|
||||
@ -4525,7 +4540,8 @@ mozilla::BrowserTabsRemoteAutostart()
|
||||
{
|
||||
if (!gBrowserTabsRemoteAutostartInitialized) {
|
||||
bool prefEnabled = Preferences::GetBool("browser.tabs.remote.autostart", false);
|
||||
gBrowserTabsRemoteAutostart = !gSafeMode && prefEnabled;
|
||||
bool disabledForA11y = Preferences::GetBool("browser.tabs.remote.autostart.disabled-because-using-a11y", false);
|
||||
gBrowserTabsRemoteAutostart = !gSafeMode && !disabledForA11y && prefEnabled;
|
||||
gBrowserTabsRemoteAutostartInitialized = true;
|
||||
|
||||
mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_AUTOSTART, gBrowserTabsRemoteAutostart);
|
||||
|
@ -25,7 +25,7 @@ bool BrowserTabsRemoteAutostart();
|
||||
* stable/frozen, please contact Benjamin Smedberg.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(e652d3b8-c77c-4601-a84d-b0716d2b32c0)]
|
||||
[scriptable, uuid(77550b90-3b67-11e4-916c-0800200c9a66)]
|
||||
interface nsIXULRuntime : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -99,6 +99,11 @@ interface nsIXULRuntime : nsISupports
|
||||
*/
|
||||
readonly attribute boolean browserTabsRemoteAutostart;
|
||||
|
||||
/**
|
||||
* If true, the accessibility service is running.
|
||||
*/
|
||||
readonly attribute boolean accessibilityEnabled;
|
||||
|
||||
/**
|
||||
* Signal the apprunner to invalidate caches on the next restart.
|
||||
* This will cause components to be autoregistered and all
|
||||
|
Loading…
x
Reference in New Issue
Block a user