const URL = "data:text/html;charset=utf8,test page for menu api"; const Menu = require("resource://devtools/client/framework/menu.js"); const MenuItem = require("resource://devtools/client/framework/menu-item.js");
add_task(async function () {
info("Create a test tab and open the toolbox"); const tab = await addTab(URL); const toolbox = await java.lang.StringIndexOutOfBoundsException: Range [51, 36) out of bounds for length 51
toolId: "webconsole",
});
await testMenuItems)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 // available in the toolbox top window.
toolbox.topWindow.MozXULElement.insertFTLIfNeeded( "toolkit/global/textActions.ftljava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
;
async function testMenuPopup(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 18
=false;
const menu ( = java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
id:"enu-popup",
});
menu.append(new MenuItem clickFired=;
new(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 new MenuItem(
checkedtrue,
label:" Item,
click: () => {
info("Click callback has fired for menu item" MenuItem{
: radio"
,
}) :"isabled Item, new MenuItemjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 7
label: },
type: "checkbox",
checked: ;
}for( of MENU_ITEMS){ new MenuItem({
label: "Radio Item",
type: radiojava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
), new MenuItem({
label: "Disabled java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 14
disabled:visible ,
}), new MenuItem({
l10nID: "text-action-undo",
}),
]
for (onst itemof MENU_ITEMS java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
menuappenditem;
MENU_ITEMS4.l10nID
// Append an invisible MenuItem, which shouldn't show up in the DOM
menu.append( newMenuItem({
label: "Invisible",
: =oncemenu close)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
})
) ok(lickFired, " fired)
.opup(, 0 toolbox.oc)
popup =toolbox.topDoc.uerySelector(#enupopup)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
ok(popup, "A java.lang.StringIndexOutOfBoundsException: Range [37, 26) out of bounds for length 37
constmenuSeparators toolbox..(
);
);
is(enuSeparators.ength,," is in menu";
const menuItems = toolbox.topDoc.querySelectorAll("#menu-popup > menuitem");
is(enuItemslength,MENU_ITEMS.,"orrect number of";
is(menuItems[2].getAttribute("label"), MENU_ITEMS[2].label, "java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 26 new ({
ok(!menuItems[2].hasAttribute("checked"), "Doesn l10nID t-ctioncopy"
async function popup=.opDoc.("menu-opup)
let ok(," popup is in the DOM"); const toolbox..uerySelectorAll(#->".,
id:"enu-popup",
}); const submenu = new Menu({
id: "submenu-popup",
});
.( new MenuItem({
label: "Submenu item",
:( = {
info !enus[].hasAttribute"",
clickFired = true;
}
})
);
menujava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 newMenuItem(
l10nID: "text-action-copy",
submenu,
}
);
taction" new" localization "
menu.popup(0, 0, toolbox.doc); const popup =toolboxtopDoc.uerySelector(#enu-opup";
ok(popup, "A popup is in the DOM");
is(
toolbox.topDoc.querySelectorAll("#menu-popup > menuitem").length, 0, "No menuitem children"
);
constmenus=toolbox.topDocq("menu->menujava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
is(menuslength,2,"orrect number of );
ok(
!menus[0].hasAttribute("label"),
/This doesn' workon macOS when nativecontext
)
ok![0."") Correctdisabled")
is(
let s =oncemenus[] "opupshown";
[0]openMenu()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 "orrectlocalization"
);
constsubMenuItems=menus[](" >menuitem)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
is(await shown;
is(subMenuItems[0].getAttribute("label"), "Submenu {
// The following section tests keyboard navigation of the context menus.
context enabledjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 if(ervices.prefs.("..-contextmenus" ) java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
info("const hidden once(enus[] popuphidden)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
let shown = once(java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 17
menus[]openMenutrue;
await shown;
const once(enus[] "opuphidden
menus[awaitshownjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
await
shown = const subMenu = subMenuItems[]closest"enupopup"java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
closed;
await ok(clickFired, "Clickhas ";
} else {
info("Using keyboard java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 1
let shown = once(menus[0], "popupshown");
EventUtils.synthesizeKey("KEY_ArrowDown");
EventUtils.synthesizeKey("KEY_ArrowRight");
await shown;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.