/usr/share/xul-ext/greasemonkey/content/menucommander.js is in xul-ext-greasemonkey 1.15-1~deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | Components.utils.import('resource://greasemonkey/util.js');
var GM_MenuCommander = {};
GM_MenuCommander.createMenuItem = function(command) {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", command.name);
if ('function' == typeof command.commandFunc) {
menuItem.addEventListener("command", command.commandFunc, true);
}
if (command.accessKey) {
menuItem.setAttribute("accesskey", command.accessKey);
}
return menuItem;
};
GM_MenuCommander.onPopupHiding = function(aMenuPopup) {
// Asynchronously. See #1632.
GM_util.timeout(function() { GM_util.emptyEl(aMenuPopup); }, 0);
}
GM_MenuCommander.onPopupShowing = function(aMenuPopup) {
// Add menu items for commands for the active window.
var haveCommands = false;
var windowId = GM_util.windowId(gBrowser.contentWindow);
if (windowId) {
GM_BrowserUI.gmSvc.withAllMenuCommandsForWindowId(
windowId,
function(index, command) {
if (command.frozen) return;
aMenuPopup.insertBefore(
GM_MenuCommander.createMenuItem(command),
aMenuPopup.firstChild);
haveCommands = true;
});
}
aMenuPopup.parentNode.disabled = !haveCommands;
};
|