Bug 878412 - Use F12 to open the Toolbox; r=jwalker

This commit is contained in:
Rob Campbell 2013-08-03 17:34:05 +01:00
parent 6505f8e6d7
commit af92feb313
3 changed files with 24 additions and 1 deletions

View File

@ -177,7 +177,7 @@
label="&devToolboxMenuItem.label;"
type="checkbox" autocheck="false"
command="Tools:DevToolbox"
key="key_devToolboxMenuItem" />
key="key_devToolboxMenuItem"/>
<broadcaster id="devtoolsMenuBroadcaster_DevToolbar"
label="&devToolbarMenu.label;"
type="checkbox" autocheck="false"
@ -262,6 +262,7 @@
<key id="key_openDownloads" key="&downloads.commandkey;" command="Tools:Downloads" modifiers="accel"/>
#endif
<key id="key_openAddons" key="&addons.commandkey;" command="Tools:Addons" modifiers="accel,shift"/>
<key id="key_devToolboxMenuItemF12" keycode="&devToolsCmd.keycode;" keytext="&devToolsCmd.keytext;" command="Tools:DevToolbox"/>
<key id="key_browserConsole" key="&browserConsoleCmd.commandkey;" command="Tools:BrowserConsole" modifiers="accel,shift"/>
<key id="key_devToolbar" keycode="&devToolbar.keycode;" modifiers="shift"
keytext="&devToolbar.keytext;" command="Tools:DevToolbarFocus"/>

View File

@ -19,6 +19,7 @@ var ProfilerController = devtools.require("devtools/profiler/controller");
const FORBIDDEN_IDS = new Set(["toolbox", ""]);
const MAX_ORDINAL = 99;
/**
* DevTools is a class that represents a set of developer tools, it holds a
* set of tools and keeps track of open toolboxes in the browser.
@ -383,6 +384,11 @@ let gDevToolsBrowser = {
gDevToolsBrowser._trackedBrowserWindows.add(win);
gDevToolsBrowser._addAllToolsToMenu(win.document);
if (this._isFirebugInstalled()) {
let broadcaster = win.document.getElementById("devtoolsMenuBroadcaster_DevToolbox");
broadcaster.removeAttribute("key");
}
let tabContainer = win.document.getElementById("tabbrowser-tabs")
tabContainer.addEventListener("TabSelect",
gDevToolsBrowser._updateMenuCheckbox, false);
@ -401,6 +407,7 @@ let gDevToolsBrowser = {
*/
attachKeybindingsToBrowser: function DT_attachKeybindingsToBrowser(doc, keys) {
let devtoolsKeyset = doc.getElementById("devtoolsKeyset");
if (!devtoolsKeyset) {
devtoolsKeyset = doc.createElement("keyset");
devtoolsKeyset.setAttribute("id", "devtoolsKeyset");
@ -410,6 +417,17 @@ let gDevToolsBrowser = {
mainKeyset.parentNode.insertBefore(devtoolsKeyset, mainKeyset);
},
/**
* Detect the presence of a Firebug.
*
* @return promise
*/
_isFirebugInstalled: function DT_isFirebugInstalled() {
let bootstrappedAddons = Services.prefs.getCharPref("extensions.bootstrappedAddons");
return bootstrappedAddons.indexOf("firebug@software.joehewitt.com") != -1;
},
/**
* Add the menuitem for a tool to all open browser windows.
*
@ -734,6 +752,7 @@ let gDevToolsBrowser = {
Services.obs.removeObserver(gDevToolsBrowser.destroy, "quit-application");
},
}
this.gDevToolsBrowser = gDevToolsBrowser;
gDevTools.on("tool-registered", function(ev, toolId) {

View File

@ -206,6 +206,9 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY webDeveloperMenu.label "Web Developer">
<!ENTITY webDeveloperMenu.accesskey "W">
<!ENTITY devToolsCmd.keycode "VK_F12">
<!ENTITY devToolsCmd.keytext "F12">
<!ENTITY devtoolsConnect.label "Connect…">
<!ENTITY devtoolsConnect.accesskey "e">