mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1198459 - Modify existing a11y prompting to support disabling a11y in content until a restart. r=felipe
This commit is contained in:
parent
2898e5de48
commit
ba3a48f0ae
@ -634,6 +634,9 @@ pref("accessibility.typeaheadfind.timeout", 5000);
|
||||
pref("accessibility.typeaheadfind.linksonly", false);
|
||||
pref("accessibility.typeaheadfind.flashBar", 1);
|
||||
|
||||
// Tracks when accessibility is loaded into the previous session.
|
||||
pref("accessibility.loadedInLastSession", false);
|
||||
|
||||
pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/?utm_source=firefox-browser&utm_medium=firefox-browser&utm_campaign=plugincheck-update");
|
||||
pref("plugins.update.notifyUser", false);
|
||||
|
||||
|
@ -1335,7 +1335,10 @@ BrowserGlue.prototype = {
|
||||
|
||||
#ifdef E10S_TESTING_ONLY
|
||||
E10SUINotification.checkStatus();
|
||||
#else
|
||||
#endif
|
||||
#ifdef XP_WIN
|
||||
// Handles prompting to inform about incompatibilites when accessibility
|
||||
// and e10s are active together.
|
||||
E10SAccessibilityCheck.init();
|
||||
#endif
|
||||
},
|
||||
@ -3085,16 +3088,9 @@ var E10SUINotification = {
|
||||
PREVIOUS_PROMPT_PREF: "browser.displayedE10SPrompt",
|
||||
|
||||
checkStatus: function() {
|
||||
let skipE10sChecks = false;
|
||||
try {
|
||||
let updateChannel = UpdateUtils.UpdateChannel;
|
||||
let channelAuthorized = updateChannel == "nightly" || updateChannel == "aurora";
|
||||
|
||||
skipE10sChecks = !channelAuthorized ||
|
||||
Services.prefs.getBoolPref("browser.tabs.remote.disabled-for-a11y");
|
||||
} catch(e) {}
|
||||
|
||||
if (skipE10sChecks) {
|
||||
let updateChannel = UpdateUtils.UpdateChannel;
|
||||
let channelAuthorized = updateChannel == "nightly" || updateChannel == "aurora";
|
||||
if (!channelAuthorized) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3108,13 +3104,6 @@ var 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.accessibilityIsBlacklistedForE10S) {
|
||||
this._showE10sAccessibilityWarning();
|
||||
}
|
||||
} else {
|
||||
let displayFeedbackRequest = false;
|
||||
try {
|
||||
@ -3174,14 +3163,6 @@ var E10SUINotification = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
if (topic == "a11y-init-or-shutdown"
|
||||
&& data == "1" &&
|
||||
Services.appinfo.accessibilityIsBlacklistedForE10S) {
|
||||
this._showE10sAccessibilityWarning();
|
||||
}
|
||||
},
|
||||
|
||||
_showE10sActivatedNotice: function() {
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
if (!win)
|
||||
@ -3262,154 +3243,118 @@ var E10SUINotification = {
|
||||
highlightLabel.setAttribute("value", highlight);
|
||||
doorhangerExtraContent.appendChild(highlightLabel);
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif // E10S_TESTING_ONLY
|
||||
|
||||
var E10SAccessibilityCheck = {
|
||||
init: function() {
|
||||
Services.obs.addObserver(this, "a11y-init-or-shutdown", true);
|
||||
Services.obs.addObserver(this, "quit-application-granted", true);
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
get forcedOn() {
|
||||
try {
|
||||
return Services.prefs.getBoolPref("browser.tabs.remote.force-enable");
|
||||
} catch (e) {}
|
||||
return false;
|
||||
},
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "quit-application-granted":
|
||||
// Tag the profile with a11y load state. We use this in nsAppRunner
|
||||
// checks on the next start.
|
||||
Services.prefs.setBoolPref("accessibility.loadedInLastSession",
|
||||
Services.appinfo.accessibilityEnabled);
|
||||
break;
|
||||
case "a11y-init-or-shutdown":
|
||||
if (data == "1") {
|
||||
// Update this so users can check this while still running
|
||||
Services.prefs.setBoolPref("accessibility.loadedInLastSession", true);
|
||||
this._showE10sAccessibilityWarning();
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_warnedAboutAccessibility: false,
|
||||
|
||||
_showE10sAccessibilityWarning: function() {
|
||||
try {
|
||||
if (!Services.prefs.getBoolPref("browser.tabs.remote.disabled-for-a11y")) {
|
||||
// Only return if the pref exists and was set to false, but not
|
||||
// if the pref didn't exist (which will throw).
|
||||
return;
|
||||
}
|
||||
} catch (e) { }
|
||||
// We don't prompt about a11y incompat if e10s is off.
|
||||
if (!Services.appinfo.browserTabsRemoteAutostart) {
|
||||
return;
|
||||
}
|
||||
|
||||
Services.prefs.setBoolPref("browser.tabs.remote.disabled-for-a11y", true);
|
||||
// If the user set the forced pref and it's true, ignore a11y init.
|
||||
// If the pref doesn't exist or if it's false, prompt.
|
||||
if (this.forcedOn) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only prompt once per session
|
||||
if (this._warnedAboutAccessibility) {
|
||||
return;
|
||||
}
|
||||
this._warnedAboutAccessibility = true;
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
if (!win) {
|
||||
// Just restart immediately.
|
||||
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);
|
||||
Services.console.logStringMessage("Accessibility support is partially disabled due to compatibility issues with new features.");
|
||||
return;
|
||||
}
|
||||
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
|
||||
// We disable a11y for content and prompt on the chrome side letting
|
||||
// a11y users know they need to disable e10s and restart.
|
||||
let promptMessage = win.gNavigatorBundle.getFormattedString(
|
||||
"e10s.accessibilityNotice.mainMessage",
|
||||
"e10s.accessibilityNotice.mainMessage2",
|
||||
[gBrandBundle.GetStringFromName("brandShortName")]
|
||||
);
|
||||
let mainAction = {
|
||||
label: win.gNavigatorBundle.getString("e10s.accessibilityNotice.disableAndRestart.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("e10s.accessibilityNotice.disableAndRestart.accesskey"),
|
||||
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 notification;
|
||||
let restartCallback = function() {
|
||||
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
|
||||
}
|
||||
};
|
||||
let secondaryActions = [
|
||||
{
|
||||
label: win.gNavigatorBundle.getString("e10s.accessibilityNotice.dontDisable.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("e10s.accessibilityNotice.dontDisable.accesskey"),
|
||||
callback: function () {
|
||||
Services.prefs.setBoolPref("browser.tabs.remote.disabled-for-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);
|
||||
},
|
||||
};
|
||||
|
||||
#else // E10S_TESTING_ONLY
|
||||
|
||||
var E10SAccessibilityCheck = {
|
||||
init: function() {
|
||||
Services.obs.addObserver(this, "a11y-init-or-shutdown", true);
|
||||
if (Services.appinfo.accessibilityEnabled) {
|
||||
this._showE10sAccessibilityWarning();
|
||||
}
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
if (topic == "a11y-init-or-shutdown"
|
||||
&& data == "1") {
|
||||
this._showE10sAccessibilityWarning();
|
||||
}
|
||||
},
|
||||
|
||||
_warnedAboutAccessibility: false,
|
||||
|
||||
_showE10sAccessibilityWarning: function() {
|
||||
try {
|
||||
if (!Services.prefs.getBoolPref("browser.tabs.remote.disabled-for-a11y")) {
|
||||
// Only return if the pref exists and was set to false, but not
|
||||
// if the pref didn't exist (which will throw).
|
||||
return;
|
||||
}
|
||||
} catch (e) { }
|
||||
|
||||
Services.prefs.setBoolPref("browser.tabs.remote.disabled-for-a11y", true);
|
||||
|
||||
if (this._warnedAboutAccessibility ||
|
||||
!Services.appinfo.browserTabsRemoteAutostart) {
|
||||
return;
|
||||
}
|
||||
this._warnedAboutAccessibility = true;
|
||||
|
||||
let win = RecentWindow.getMostRecentBrowserWindow();
|
||||
if (!win) {
|
||||
// Just restart immediately.
|
||||
// Restart the browser
|
||||
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);
|
||||
return;
|
||||
}
|
||||
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
|
||||
let promptMessage = win.gNavigatorBundle.getFormattedString(
|
||||
"e10s.accessibilityNotice.mainMessage",
|
||||
[gBrandBundle.GetStringFromName("brandShortName")]
|
||||
);
|
||||
let mainAction = {
|
||||
label: win.gNavigatorBundle.getString("e10s.accessibilityNotice.disableAndRestart.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("e10s.accessibilityNotice.disableAndRestart.accesskey"),
|
||||
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: win.gNavigatorBundle.getString("e10s.accessibilityNotice.dontDisable.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("e10s.accessibilityNotice.dontDisable.accesskey"),
|
||||
callback: function () {
|
||||
Services.prefs.setBoolPref("browser.tabs.remote.disabled-for-a11y", false);
|
||||
}
|
||||
}
|
||||
];
|
||||
// main option: an Ok button, keeps running with content accessibility disabled
|
||||
let mainAction = {
|
||||
label: win.gNavigatorBundle.getString("e10s.accessibilityNotice.acceptButton.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("e10s.accessibilityNotice.acceptButton.accesskey"),
|
||||
callback: function () {
|
||||
// If the user invoked the button option remove the notification,
|
||||
// otherwise keep the alert icon around in the address bar.
|
||||
notification.remove();
|
||||
},
|
||||
dismiss: true
|
||||
};
|
||||
// secondary option: a restart now button. When we restart e10s will be disabled due to
|
||||
// accessibility having been loaded in the previous session.
|
||||
let secondaryActions = [{
|
||||
label: win.gNavigatorBundle.getString("e10s.accessibilityNotice.enableAndRestart.label"),
|
||||
accessKey: win.gNavigatorBundle.getString("e10s.accessibilityNotice.enableAndRestart.accesskey"),
|
||||
callback: restartCallback,
|
||||
}];
|
||||
let options = {
|
||||
popupIconURL: "chrome://browser/skin/e10s-64@2x.png",
|
||||
learnMoreURL: "https://wiki.mozilla.org/Electrolysis",
|
||||
persistWhileVisible: true
|
||||
learnMoreURL: "https://support.mozilla.org/kb/accessibility-and-ppt",
|
||||
persistWhileVisible: true,
|
||||
hideNotNow: true,
|
||||
};
|
||||
|
||||
win.PopupNotifications.show(browser, "a11y_enabled_with_e10s", promptMessage, null, mainAction, secondaryActions, options);
|
||||
notification =
|
||||
win.PopupNotifications.show(browser, "a11y_enabled_with_e10s",
|
||||
promptMessage, null, mainAction,
|
||||
secondaryActions, options);
|
||||
},
|
||||
};
|
||||
|
||||
#endif // E10S_TESTING_ONLY
|
||||
|
||||
var components = [BrowserGlue, ContentPermissionPrompt, AboutNewTabService];
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
|
||||
|
||||
|
@ -6,6 +6,10 @@ Components.utils.import("resource://gre/modules/Downloads.jsm");
|
||||
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/Task.jsm");
|
||||
Components.utils.import("resource:///modules/TransientPrefs.jsm");
|
||||
#ifdef E10S_TESTING_ONLY
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
#endif
|
||||
|
||||
var gMainPane = {
|
||||
/**
|
||||
@ -97,7 +101,13 @@ var gMainPane = {
|
||||
e10sCheckbox.checked = true;
|
||||
} else {
|
||||
e10sCheckbox.disabled = true;
|
||||
e10sCheckbox.label += " (disabled: " + e10sBlockedReason.data + ")";
|
||||
let updateChannel = UpdateUtils.UpdateChannel;
|
||||
// only add this label on developer channels
|
||||
if (updateChannel == "default" ||
|
||||
updateChannel == "nightly" ||
|
||||
updateChannel == "aurora") {
|
||||
e10sCheckbox.label += " (disabled: " + e10sBlockedReason.data + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -750,10 +750,8 @@ appMenuRemoteTabs.mobilePromo.ios = Firefox for iOS
|
||||
# e10s.postActivationInfobar.learnMore.label
|
||||
# e10s.postActivationInfobar.learnMore.accesskey
|
||||
# e10s.accessibilityNotice.mainMessage
|
||||
# e10s.accessibilityNotice.disableAndRestart.label
|
||||
# e10s.accessibilityNotice.disableAndRestart.accesskey
|
||||
# e10s.accessibilityNotice.dontDisable.label
|
||||
# e10s.accessibilityNotice.dontDisable.accesskey):
|
||||
# e10s.accessibilityNotice.enableAndRestart.label
|
||||
# e10s.accessibilityNotice.enableAndRestart.accesskey
|
||||
# These strings are related to the messages we display to offer e10s (Multi-process) to users
|
||||
# on the pre-release channels. They won't be used in release but they will likely be used in
|
||||
# beta starting from version 41, so it's still useful to have these strings properly localized.
|
||||
@ -768,11 +766,11 @@ e10s.offerPopup.noThanks.accesskey = N
|
||||
e10s.postActivationInfobar.message = You're now helping to test multi-process in %S! Please report problems you find.
|
||||
e10s.postActivationInfobar.learnMore.label = Learn More
|
||||
e10s.postActivationInfobar.learnMore.accesskey = L
|
||||
e10s.accessibilityNotice.mainMessage = Multi-process does not yet support accessibility features. Multi-process will be disabled if you restart %S. Would you like to restart?
|
||||
e10s.accessibilityNotice.disableAndRestart.label = Disable and Restart
|
||||
e10s.accessibilityNotice.disableAndRestart.accesskey = R
|
||||
e10s.accessibilityNotice.dontDisable.label = Don't Disable
|
||||
e10s.accessibilityNotice.dontDisable.accesskey = D
|
||||
e10s.accessibilityNotice.mainMessage2 = Accessibility support is partially disabled due to compatibility issues with new %S features.
|
||||
e10s.accessibilityNotice.acceptButton.label = Ok
|
||||
e10s.accessibilityNotice.acceptButton.accesskey = O
|
||||
e10s.accessibilityNotice.enableAndRestart.label = Enable (Requires Restart)
|
||||
e10s.accessibilityNotice.enableAndRestart.accesskey = E
|
||||
|
||||
# LOCALIZATION NOTE (usercontext.personal.label,
|
||||
# usercontext.work.label,
|
||||
|
Loading…
Reference in New Issue
Block a user