Bug 832984 - Ctrl + Shift + K shortcut for the Web Console stopped working (sometimes). r=jwalker

This commit is contained in:
Paul Rouget 2013-01-22 20:10:21 +02:00
parent 4116af146e
commit 679d3673d4

View File

@ -341,6 +341,28 @@ let gDevToolsBrowser = {
gDevToolsBrowser._updateMenuCheckbox, false);
},
/**
* Add a <key> to <keyset id="devtoolsKeyset">.
* Appending a <key> element is not always enough. The <keyset> needs
* to be detached and reattached to make sure the <key> is taken into
* account (see bug 832984).
*
* @param {XULDocument} doc
* The document to which keys are to be added
* @param {XULElement} or {DocumentFragment} keys
* Keys to add
*/
attachKeybindingsToBrowser: function DT_attachKeybindingsToBrowser(doc, keys) {
let devtoolsKeyset = doc.getElementById("devtoolsKeyset");
if (!devtoolsKeyset) {
devtoolsKeyset = doc.createElement("keyset");
devtoolsKeyset.setAttribute("id", "devtoolsKeyset");
}
devtoolsKeyset.appendChild(keys);
let mainKeyset = doc.getElementById("mainKeyset");
mainKeyset.parentNode.insertBefore(devtoolsKeyset, mainKeyset);
},
/**
* Add the menuitem for a tool to all open browser windows.
*
@ -366,7 +388,7 @@ let gDevToolsBrowser = {
doc.getElementById("mainCommandSet").appendChild(elements.cmd);
if (elements.key) {
doc.getElementById("mainKeyset").appendChild(elements.key);
this.attachKeybindingsToBrowser(doc, elements.keys);
}
doc.getElementById("mainBroadcasterSet").appendChild(elements.bc);
@ -420,8 +442,7 @@ let gDevToolsBrowser = {
let mcs = doc.getElementById("mainCommandSet");
mcs.appendChild(fragCommands);
let mks = doc.getElementById("mainKeyset");
mks.appendChild(fragKeys);
this.attachKeybindingsToBrowser(doc, fragKeys);
let mbs = doc.getElementById("mainBroadcasterSet");
mbs.appendChild(fragBroadcasters);