mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Bug 597129 - "Paste & Go" or "Paste & Search" trigger two pastes, including to content. r=gavin, a=blocking
This commit is contained in:
parent
fd89b579c1
commit
9af5de23dc
@ -129,18 +129,30 @@
|
||||
"anonid", "textbox-input-box");
|
||||
var cxmenu = document.getAnonymousElementByAttribute(textBox,
|
||||
"anonid", "input-box-contextmenu");
|
||||
var pasteAndGo;
|
||||
cxmenu.addEventListener("popupshowing", function() {
|
||||
if (!pasteAndGo)
|
||||
return;
|
||||
var controller = document.commandDispatcher.getControllerForCommand("cmd_paste");
|
||||
var enabled = controller.isCommandEnabled("cmd_paste");
|
||||
if (enabled)
|
||||
pasteAndGo.removeAttribute("disabled");
|
||||
else
|
||||
pasteAndGo.setAttribute("disabled", "true");
|
||||
}, false);
|
||||
|
||||
var insertLocation = cxmenu.firstChild;
|
||||
while (insertLocation.nextSibling &&
|
||||
insertLocation.getAttribute("cmd") != "cmd_paste")
|
||||
insertLocation = insertLocation.nextSibling;
|
||||
if (insertLocation) {
|
||||
let element = document.createElement("menuitem");
|
||||
pasteAndGo = document.createElement("menuitem");
|
||||
let label = Services.strings.createBundle("chrome://browser/locale/browser.properties").
|
||||
GetStringFromName("pasteAndGo.label");
|
||||
element.setAttribute("label", label);
|
||||
element.setAttribute("cmd", "cmd_paste");
|
||||
element.setAttribute("oncommand", "goDoCommand('cmd_paste'); gURLBar.handleCommand();");
|
||||
cxmenu.insertBefore(element, insertLocation.nextSibling);
|
||||
pasteAndGo.setAttribute("label", label);
|
||||
pasteAndGo.setAttribute("anonid", "paste-and-go");
|
||||
pasteAndGo.setAttribute("oncommand", "goDoCommand('cmd_paste'); gURLBar.handleCommand();");
|
||||
cxmenu.insertBefore(pasteAndGo, insertLocation.nextSibling);
|
||||
}
|
||||
]]></constructor>
|
||||
|
||||
|
@ -578,6 +578,17 @@
|
||||
"anonid", "textbox-input-box");
|
||||
var cxmenu = document.getAnonymousElementByAttribute(textBox,
|
||||
"anonid", "input-box-contextmenu");
|
||||
var pasteAndSearch;
|
||||
cxmenu.addEventListener("popupshowing", function() {
|
||||
if (!pasteAndSearch)
|
||||
return;
|
||||
var controller = document.commandDispatcher.getControllerForCommand("cmd_paste");
|
||||
var enabled = controller.isCommandEnabled("cmd_paste");
|
||||
if (enabled)
|
||||
pasteAndSearch.removeAttribute("disabled");
|
||||
else
|
||||
pasteAndSearch.setAttribute("disabled", "true");
|
||||
}, false);
|
||||
|
||||
var element, label, akey;
|
||||
|
||||
@ -592,9 +603,10 @@
|
||||
element = document.createElementNS(kXULNS, "menuitem");
|
||||
label = this._stringBundle.getString("cmd_pasteAndSearch");
|
||||
element.setAttribute("label", label);
|
||||
element.setAttribute("cmd", "cmd_paste");
|
||||
element.setAttribute("anonid", "paste-and-search");
|
||||
element.setAttribute("oncommand", "goDoCommand('cmd_paste'); document.getElementById('searchbar').handleSearchCommand();");
|
||||
cxmenu.insertBefore(element, insertLocation.nextSibling);
|
||||
pasteAndSearch = element;
|
||||
}
|
||||
|
||||
element = document.createElementNS(kXULNS, "menuitem");
|
||||
|
Loading…
x
Reference in New Issue
Block a user