[Project_owners] onpopupshowing event - many more sections show up in context menu

Mook mook.moz at gmail.com
Tue Dec 13 13:35:15 EST 2005


On 12/13/05, danvb30-firefox at yahoo.com <danvb30-firefox at yahoo.com> wrote:
> I'm a Firefox extension author newbie, and I'm getting some funny behavior with the
> "onpopupshowing" event of the popup object.
>
> In my .xul file, I have the popup declared, with the 2 menuitem objects.  This creates the context
> menu entries that I want - all is well.
>
> Now I'm trying to add some code to dynamically remove my menu items if nothing is selected in the
> browser.  To do this, I register the "onpopupshowing" event, pointing to my function.
>
> As soon as I register this event, even if I dont have any code in the handler, I now get a much
> larger context menu, with a bunch of extra context menu "sections".  When I remove the event
> handler from the .xul description, the context menu goes back down to what it was previously.
>
> It seems like as soon as I have a handler, the menu mechanism is interacting somehow with other
> extensions and adding their context menus, when previously they weren't added (when I don't have
> the handler)?
>
> Rather than describe the different sections and what I'm seeing, I took a couple screenshots and
> put them here.
> http://www.volleynerd.com/firefox/extensions/contextmenu.htm
>
> Any clues on what's going on here?
>
Firefox has its own onpopupshowing [1] that is used to filter for what
to show; if you override it, then nobody else gets hidden by that
function, of course :)  You'll probably want to copy what the core
code does [2].


[1] http://lxr.mozilla.org/mozilla/source/browser/base/content/browser-context.inc#38
[2] http://lxr.mozilla.org/mozilla/source/browser/base/content/browser.js#4040
--
Mook
mook.moz at gmail


More information about the Project_owners mailing list