mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 611590 - Make "Paste & Go" consistent with "Paste" regardless of clipboard contents. r=gavin ui-r=faaborg a=betaN+gavin
This commit is contained in:
parent
f12a85806e
commit
4c9b151a50
@ -130,24 +130,11 @@
|
||||
if (!pasteAndGo)
|
||||
return;
|
||||
var controller = document.commandDispatcher.getControllerForCommand("cmd_paste");
|
||||
var couldBeURL = controller.isCommandEnabled("cmd_paste");
|
||||
if (couldBeURL) {
|
||||
let cbSvc = Cc["@mozilla.org/widget/clipboard;1"].
|
||||
getService(Ci.nsIClipboard);
|
||||
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||
createInstance(Ci.nsITransferable);
|
||||
xferable.addDataFlavor("text/unicode");
|
||||
cbSvc.getData(xferable, cbSvc.kGlobalClipboard);
|
||||
let data = {};
|
||||
xferable.getTransferData("text/unicode", data, {});
|
||||
data = data.value.QueryInterface(Ci.nsISupportsString).data;
|
||||
try {
|
||||
makeURI(data);
|
||||
} catch (ex) { // clipboard data is not a URL
|
||||
couldBeURL = false;
|
||||
}
|
||||
}
|
||||
pasteAndGo.hidden = !couldBeURL;
|
||||
var enabled = controller.isCommandEnabled("cmd_paste");
|
||||
if (enabled)
|
||||
pasteAndGo.removeAttribute("disabled");
|
||||
else
|
||||
pasteAndGo.setAttribute("disabled", "true");
|
||||
}, false);
|
||||
|
||||
var insertLocation = cxmenu.firstChild;
|
||||
|
Loading…
Reference in New Issue
Block a user