I’m trying to get a new item using context-menu on every popup window I’m forced to use, but I get this new item on the context menu of the parent window, but not on any of it’s children windows.
What I am using I think it’s quite simple code:
var self = require("sdk/self");
var contextMenu = require("sdk/context-menu");
// Create a new context menu item.
var menuItem = contextMenu.Item({
label: "DEBUG: Cool option here",
contentScriptWhen: 'ready',
contentScriptFile: self.data.url("getdata.js"),
onMessage: function () {
...some processing here...
}
});
Any tip on how to get this item available on any window?.
It’s possible the SDK only supports main frames and not popups. I would usually suggest to file an SDK bug about this, but we’re in the process of coming up with something else (more news soon), so I doubt this would be fixed.
Hi, just stumbled upon the same issue with popups and context menu items, and I wonder if there are plans to fix this 6 months later? Or is there another recommended Addon creation approach, besides the SDK that deals properly with popups?
P.S. The suggested workaround works well (though I had to also set browser.link.open_newwindow to 3), but it’s definitely an incovenience.
WebExtensions is the future API for add-on development. The SDK will continue to be maintained for a while, but it will rely heavily on community contributions. If you think you can contribute a fix to this API, you can find the repository here.