diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index bb11ad388bed..12ffdb99d57c 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -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 diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 46259530bd19..29ec062ae038 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -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); diff --git a/xpcom/system/nsIXULRuntime.idl b/xpcom/system/nsIXULRuntime.idl index 4f98eed3f232..0daf62c6e851 100644 --- a/xpcom/system/nsIXULRuntime.idl +++ b/xpcom/system/nsIXULRuntime.idl @@ -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