I have tried to:
that is my code , which fail to show menu item at all :
var contextMenu = require("sdk/context-menu");
var menuItem = contextMenu.Item({
label : "Show the url",
context : contextMenu.SelectorContext("a[href]"),
contentScript : 'self.on("click", function (node , data) {' + ' self.postMessage(node.src);' +'});',
onMessage: function (url) { console.log(url);}
});
I have got the following log :
console.log: rd-addon: null
change:
context : contextMenu.SelectorContext("a[href]"),
to
context: contextMenu.URLContext("*"),