Need the ability to do a context menu in the embedding case




19 years ago
18 years ago


(Reporter: travis, Assigned: adamlock)




Firefox Tracking Flags

(Not tracked)


(Whiteboard: [nsbeta3+])



19 years ago
Embedding currently has no ability to do a context menu.  In some way we are 
going to have to hook up a xul window to provide the context menus for our 


19 years ago
Blocks: 35556

Comment 1

19 years ago
Sorry for the spam, changing QA contact.
QA Contact: paulmac → jrgm

Comment 2

19 years ago
-> adam
Assignee: travis → adamlock

Comment 3

19 years ago
The easiest way to implement popups with no explicit support from mozilla is to 
register a mouse DOM event listener on the current document. When the MouseDown 
event fires, use the nsIDOMMouseEvent to ensure that it's the rightmouse button 
and to get the DOM node/element was clicked on.

I'm currently thinking of ways I could put some of this code into webbrowser. 
Ideally I would like webbrowser to detect the right mouse click and and notify 
the client to deal with it. How abstract this should be is undecided.

Comment 4

19 years ago
I also investigated webbrowser and noticed that it always assumes that it's the 
topmost content docshelltreeitem, never chrome. If we intend to allow XUL popup 
menus, then webbrowser will have to be a chrome docshelltree item so that we can 
attach a XUL popup handler to an invisible chrome wrapper around the content 
that catches mouse events.


19 years ago


19 years ago
Keywords: embed


19 years ago
Keywords: nsbeta3

Comment 5

19 years ago
A desirable further requirement is for developers who use the embedding XUL to 
be able to implement C++ callback on their webbrowser site which is called when 
the XUL popup is about to be displayed. The callback gives the site the chance 
to remove, add, enable & disable items on the menu before they are shown. When 
an item from the menu is selected, the C++ is called once more with the result 
which it can choose to what it likes with or let the XUL do the default 

To kick some ideas around, here are some of the issues to be resolved.

1. Is the menu callback done every time or just the once? If it's done 
everytime, it means the menu has to be rebuilt and makes it more costly to 
2. Are submenus allowed? If yes then we might as pass the menu's DOM to the C++ 
client and let them do what they like with it.
3. Can we mix C++ menu items with standard XUL onclick handled items?
4. Do we pass a 'context' with the menu. The C++ might want to show different 
items for a click on a link than for selected text.

An alternative to all this would be to implement a Javascript global object with 
some simple methods - doCommand() and queryCommand(). The embedder would 
implement the dynamic menu logic entirely in Javascript and use the helper 
object if it needed to call to the C++ for any reason.

Comment 6

19 years ago
Whiteboard: nsbeta3+


19 years ago
Whiteboard: nsbeta3+ → [nsbeta3+]


19 years ago
Target Milestone: --- → M18

Comment 7

19 years ago
Adding requirement of 48220 to here:

nsIContextMenuListener needs an input field enum

Comment 8

19 years ago
*** Bug 48220 has been marked as a duplicate of this bug. ***

Comment 9

19 years ago
Fix checked in
Last Resolved: 19 years ago
Resolution: --- → FIXED

Comment 10

18 years ago
How can I verify this bug

Comment 11

18 years ago
Blanca, there are two ways:

1. Take my word for it that it's working :)
2. Build mozilla/embedding/browser/activex/tests/cbrowse on Win32. Install the 
Mozilla ActiveX control as per the instructions on Run CBrowse, selecting the Mozilla 
control to test. Browse to a web page, e.g. and right 
click anywhere on it. If a popup menu appears, the context menu code is working.

Comment 12

18 years ago
Updating QA Contact
QA Contact: jrgm → mdunn

Comment 13

18 years ago
Correction: Changing QA contact for the Embed API bugs to David Epstein.
QA Contact: mdunn → depstein


18 years ago
QA Contact: depstein → dsirnapalli

Comment 14

18 years ago
change qa contact to dsirnapalli. He'll work with context menus.

Comment 15

18 years ago
In mfcEmbed the context menu is working.This mean embedding currently has the 
ability to do a context menu. marking it to verified.
You need to log in before you can comment on or make changes to this bug.