Bug 653221 - Create Web Developer Sub-menu in the Tools menu; r=dao

This commit is contained in:
Rob Campbell 2011-05-09 11:51:52 -03:00
parent 481c83b73a
commit 251d829071
4 changed files with 82 additions and 29 deletions

View File

@ -315,11 +315,6 @@
</menu>
#include browser-charsetmenu.inc
<menuseparator/>
<menuitem id="menu_pageSource"
accesskey="&pageSourceCmd.accesskey;"
label="&pageSourceCmd.label;"
key="key_viewSource"
command="View:PageSource"/>
<menuitem id="fullScreenItem"
accesskey="&fullScreenCmd.accesskey;"
label="&fullScreenCmd.label;"
@ -539,30 +534,41 @@
oncommand="gSyncUI.doSync(event);"/>
#endif
<menuseparator id="devToolsSeparator"/>
<menuitem id="menu_pageinspect"
type="checkbox"
hidden="true"
label="&inspectMenu.label;"
accesskey="&inspectMenu.accesskey;"
key="key_inspect"
command="Tools:Inspect"/>
<menuitem id="javascriptConsole"
hidden="true"
label="&errorConsoleCmd.label;"
accesskey="&errorConsoleCmd.accesskey;"
key="key_errorConsole"
oncommand="toJavaScriptConsole();"/>
<menuitem id="webConsole"
label="&webConsoleCmd.label;"
accesskey="&webConsoleCmd.accesskey;"
key="key_webConsole"
oncommand="HUDConsoleUI.toggleHUD();"/>
<menuitem id="menu_scratchpad"
hidden="true"
label="&scratchpad.label;"
accesskey="&scratchpad.accesskey;"
key="key_scratchpad"
command="Tools:Scratchpad"/>
<menu id="webDeveloperMenu"
label="&webDeveloperMenu.label;"
accesskey="webDeveloperMenu.accesskey;">
<menupopup id="menuWebDeveloperPopup">
<menuitem id="webConsole"
label="&webConsoleCmd.label;"
accesskey="&webConsoleCmd.accesskey;"
key="key_webConsole"
oncommand="HUDConsoleUI.toggleHUD();"/>
<menuitem id="menu_pageinspect"
type="checkbox"
hidden="true"
label="&inspectMenu.label;"
accesskey="&inspectMenu.accesskey;"
key="key_inspect"
command="Tools:Inspect"/>
<menuitem id="menu_scratchpad"
hidden="true"
label="&scratchpad.label;"
accesskey="&scratchpad.accesskey;"
key="key_scratchpad"
command="Tools:Scratchpad"/>
<menuitem id="menu_pageSource"
accesskey="&pageSourceCmd.accesskey;"
label="&pageSourceCmd.label;"
key="key_viewSource"
command="View:PageSource"/>
<menuitem id="javascriptConsole"
hidden="true"
label="&errorConsoleCmd.label;"
accesskey="&errorConsoleCmd.accesskey;"
key="key_errorConsole"
oncommand="toJavaScriptConsole();"/>
</menupopup>
</menu>
<menuitem id="menu_pageInfo"
accesskey="&pageInfoCmd.accesskey;"
label="&pageInfoCmd.label;"

View File

@ -229,6 +229,7 @@ _BROWSER_FILES = \
browser_visibleTabs_bookmarkAllPages.js \
browser_visibleTabs_bookmarkAllTabs.js \
browser_visibleTabs_tabPreview.js \
browser_webdev_menu.js \
bug592338.html \
disablechrome.html \
discovery.html \

View File

@ -0,0 +1,43 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function menuTest()
{
gBrowser.selectedBrowser.removeEventListener("load", menuTest, true);
let menuContents = [
"menu_pageinspect",
"webConsole",
"menu_scratchpad",
"menu_pageSource",
"javascriptConsole"
];
let menu = document.getElementById("webDeveloperMenu");
ok(menu, "we have the menu");
let popup = menu.firstChild;
is(popup.id, "menuWebDeveloperPopup", "menu first child is menuWebDeveloperPopup");
is(popup.childNodes.length, menuContents.length, "popup childNodes.length matches");
for(let a = 0; a < popup.children.length; a++) {
isnot(menuContents.indexOf(popup.children[a].id), -1, "menuitem " + popup.children[a].id + " in popup");
};
gBrowser.removeCurrentTab();
finish();
}
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", menuTest, true);
content.location = "data:text/html,<title>Web Developer Menu Test</title>" +
"<p>testing the Web Developer Menu";
}

View File

@ -179,6 +179,9 @@ can reach it easily. -->
<!ENTITY addons.accesskey "A">
<!ENTITY addons.commandkey "A">
<!ENTITY webDeveloperMenu.label "Web Developer">
<!ENTITY webDeveloperMenu.accesskey "W">
<!ENTITY errorConsoleCmd.label "Error Console">
<!ENTITY errorConsoleCmd.accesskey "C">
<!ENTITY errorConsoleCmd.commandkey "j">