Bug 1602075 - display Inspect Accessibility Properties menu item if devtools.accessibility.auto-init.enabled pref is set to true. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D71586
This commit is contained in:
Yura Zenevich 2020-04-27 14:00:18 +00:00
Родитель bc95831e38
Коммит f25cf1bb96
3 изменённых файлов: 25 добавлений и 5 удалений

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

@ -503,8 +503,13 @@ class nsContextMenu {
var showInspectA11Y =
showInspect &&
// Only when accessibility service started.
Services.appinfo.accessibilityEnabled &&
// Only when accessibility service started or the panel can be
// auto-enabled.
(Services.appinfo.accessibilityEnabled ||
Services.prefs.getBoolPref(
"devtools.accessibility.auto-init.enabled",
false
)) &&
this.inTabBrowser &&
Services.prefs.getBoolPref("devtools.enabled", true) &&
Services.prefs.getBoolPref("devtools.accessibility.enabled", true) &&

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

@ -87,7 +87,10 @@ function getVisibleMenuItems(aMenu, aData) {
item.id != "fill-login-no-logins" &&
// XXX Screenshots doesn't have an access key. This needs
// at least bug 1320462 fixing first.
item.id != "screenshots_mozilla_org-menuitem-_create-screenshot"
item.id != "screenshots_mozilla_org-menuitem-_create-screenshot" &&
// Inspect accessibility properties does not have an access key. See
// bug 1630717 for more details.
item.id != "context-inspect-a11y"
) {
if (item.id != FRAME_OS_PID) {
ok(key, "menuitem " + item.id + " has an access key");
@ -432,7 +435,11 @@ async function test_contextmenu(selector, menuItems, options = {}) {
if (
Services.prefs.getBoolPref("devtools.accessibility.enabled", true) &&
Services.appinfo.accessibilityEnabled
(Services.appinfo.accessibilityEnabled ||
Services.prefs.getBoolPref(
"devtools.accessibility.auto-init.enabled",
false
))
) {
let inspectA11YItems = ["context-inspect-a11y", true];
menuItems = menuItems.concat(inspectA11YItems);

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

@ -30,7 +30,15 @@ add_task(async function testNoShowAccessibilityPropertiesContextMenu() {
const inspectA11YPropsItem = contextMenu.querySelector(
"#context-inspect-a11y"
);
ok(inspectA11YPropsItem.hidden, "Accessibility tools are not enabled.");
const visible = Services.prefs.getBoolPref(
"devtools.accessibility.auto-init.enabled",
false
);
isnot(
inspectA11YPropsItem.hidden,
visible,
"Accessibility tools have the right visibility."
);
contextMenu.hidePopup();
gBrowser.removeCurrentTab();
});