Available new item via context-menu on popup window

Hi there,

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?.

Cheers, Ibon.

That looks right to me, it didnt work?

I wish there were some more sdk people around here, i dont know jack about sdk.

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.

Hopefully backwards compatible? :smile:

I’ve workaround it by forcing popup windows to show like tabs:

browser.link.open_newwindow.restriction set to 0

This way I can use a custom context menu option :smile:

Many thanks you all anyway.

Cheers, Ibon.

2 Likes

Thanks for sharing your soloution it will help others when they come across this topic

My wife gave me the idea to make a context menu in addition, for short workflow. </>

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.

1 Like

indent preformatted text by 4 spaces

onClick(function(object[,])onClick.via)

"I might have the rest saved somewhere on my plus.drive its a thing called search.htm