spotter
spotter

Reputation: 1216

Can one add the normal "contentAreaContextMenu" to a XUL browser element?

I am playing around with a xul browser element in a sidebar (the idea is to be able to dynamically control its contents).

While, I've figured out how to manually construct a context menu from documentation online

<window id="main-window">
  <popupset>
     <menupopup id="ins-del-menu" onpopupshowing="showHideItems()">
       <menuitem label="Insert"/>
       <menuitem label="Delete"/>
     </menupopup>
  </popupset>
</window>
<browser id="mypanel-browser" type="chrome" src="chrome://emptysidebar/content/test.html" context="ins-del-menu" flex="1"/>

That's obviously not really the context menu I want (and it be somewhat of waste of effort I think to try and duplicate the normal context menu.

should I be able to to specify my context= to be contentAreaContextMenu? (it doesn't seem to work, but perhaps I was doing something stupid).

any help would be appreciated.

Upvotes: 2

Views: 404

Answers (1)

Wladimir Palant
Wladimir Palant

Reputation: 57681

The contentAreaContextMenu element is defined in the browser window (actual menu contents). And there is lots of code driving that menu, plus code implementing the commands that the context menu refers to. Getting all this out of the browser window is close to impossible (even if you managed to do it, you would be making assumptions that will likely break with the next Firefox release), there is sadly no way around reimplementing the necessary parts in your own window.

Upvotes: 1

Related Questions