[Project_owners] Removing Contextmenu menuitem form multiple windows.

Nickolay Ponomarev asqueella at gmail.com
Mon Apr 9 03:26:19 PDT 2007


On 4/9/07, Varun <varun21 at gmail.com> wrote:
> Hi,
>
> My extension overlays browser.xul and has a tab contect menu item which is
> added to the tab-context menu on window.load
>
> is there a way that i can remove this menuitem dynamically, if i already
> have multiple windows open? I'm currently trying
> 'ctsep' and 'ctTabCtx' are the id's of my seperator and menuitem.

Are you doing this in response to a preference change? You might want
to register a pref listener (via nsIPrefBranch2 interface) in each
window, each of those listeners removing/adding the context menu in
its own window. I.e.

var menuItem = document.getElementById("your-id");
menuItem.parentNode.removeChild(menuItem);

Any particular problem you had with the code you posted?

Nickolay


More information about the Project_owners mailing list