mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1686238: Only attempt to traverse containers menu if containers are enabled and defined r=yzen
Differential Revision: https://phabricator.services.mozilla.com/D102799
This commit is contained in:
parent
cdbe04ecfa
commit
7dc8c1a190
@ -199,12 +199,14 @@ add_task(async () => {
|
||||
Assert.ok(Services.search.isInitialized);
|
||||
}
|
||||
|
||||
const hasContainers =
|
||||
Services.prefs.getBoolPref("privacy.userContext.enabled") &&
|
||||
ContextualIdentityService.getPublicIdentities().length;
|
||||
|
||||
// synthesize a right click on the link to open the link context menu
|
||||
let menu = document.getElementById("contentAreaContextMenu");
|
||||
await BrowserTestUtils.synthesizeMouse(
|
||||
await BrowserTestUtils.synthesizeMouseAtCenter(
|
||||
"#exampleLink",
|
||||
2,
|
||||
2,
|
||||
{ type: "contextmenu" },
|
||||
browser
|
||||
);
|
||||
@ -212,16 +214,19 @@ add_task(async () => {
|
||||
|
||||
menu = await getMacAccessible(menu);
|
||||
let menuChildren = menu.getAttributeValue("AXChildren");
|
||||
// menu contains 12 items and 3 splitters for 15 items total
|
||||
// menu contains 14 items when containers disabled, 15 items otherwise
|
||||
const expectedChildCount = hasContainers ? 15 : 14;
|
||||
is(
|
||||
menuChildren.length,
|
||||
15,
|
||||
"Context menu on link contains fifteen items"
|
||||
expectedChildCount,
|
||||
"Context menu on link contains 14 or 15 items depending on release"
|
||||
);
|
||||
|
||||
// items at indicies 4, 10, and 12 are the splitters when containers exist
|
||||
// everything else should be a menu item, otherwise indicies of splitters are
|
||||
// 3, 9, and 11
|
||||
const splitterIndicies = hasContainers ? [4, 10, 12] : [3, 9, 11];
|
||||
for (let i = 0; i < menuChildren.length; i++) {
|
||||
// items at indicies 4, 10, and 12 are the splitters, everything else should be a menu item
|
||||
if (i == 4 || i == 10 || i == 12) {
|
||||
if (splitterIndicies.includes(i)) {
|
||||
is(
|
||||
menuChildren[i].getAttributeValue("AXRole"),
|
||||
"AXSplitter",
|
||||
@ -236,18 +241,13 @@ add_task(async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// submenus are at indicies 1 and 10
|
||||
// first check they have no children when hidden
|
||||
// check the containers sub menu in depth if it exists
|
||||
if (hasContainers) {
|
||||
is(
|
||||
menuChildren[1].getAttributeValue("AXVisibleChildren"),
|
||||
null,
|
||||
"Submenu 1 has no visible chldren when hidden"
|
||||
);
|
||||
is(
|
||||
menuChildren[11].getAttributeValue("AXVisibleChildren"),
|
||||
null,
|
||||
"Submenu 2 has no visible chldren when hidden"
|
||||
);
|
||||
|
||||
// focus the first submenu
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown");
|
||||
@ -283,6 +283,8 @@ add_task(async () => {
|
||||
// close context menu
|
||||
EventUtils.synthesizeKey("KEY_Escape");
|
||||
await waitForMacEvent("AXMenuClosed");
|
||||
}
|
||||
|
||||
EventUtils.synthesizeKey("KEY_Escape");
|
||||
await waitForMacEvent("AXMenuClosed");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user