Currently the only way to do this (AFAIK) is to go through private interfaces.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: mozilla0.9.1 → mozilla0.9.2
A mouse listener like the one used in TestGtkEmbed for example.
Eh? Do you mean an XPCOM service for adding DOM event listeners? Sort of like the MailNews MsgMailSession? http://www.mozilla.org/mailnews/arch/events.html Or like Embedded has for various browser status things? http://www.mozilla.org/projects/embedding/listeners.html That would be sweet.
It may be possible to extend the impl of nsIWebBrowser to support DOM listeners. Obtaining the nsIEventReceiver interface is very nasty, as GetEventReceiver demonstrates. http://lxr.mozilla.org/seamonkey/source/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp#83 However once you obtain the nsIEventReceiver, the methods for subscribing (addEventListenerByIID & removeEventListenerByIID) are very similar to nsIWebBrowser's addWebBrowserListener & removeWebBrowserListener. It should be possible to map calls from one onto the other without breaking the semantics of the interface.
Severity: critical → major
This patch moves the helper function GetEventReceiver from nsDocShellTreeOwner.cpp into the nsWebBrowser class and extends nsIWebBrowser::AddWebBrowserListener & RemoveWebBrowserListener such that they use it to (de)register DOM event listener objects.
Comment on attachment 113621 [details] [diff] [review] Patch Can I have an r/sr on this patch to the webbrowser object. It extends addWebBrowserListener / removeWebBrowserListener so that embedders may call these methods to add / remove DOM event listeners. Most of the patch is just moving a helper method from one source file to another and making it a member of the nsWebBrowser class. Thanks
Looks nice. No problem with the code itself, but one question: are you sure that this + rv = rcvr->AddEventListenerByIID(domListener, aIID); maintains only a weak reference to the listener?
Does someone know the reason this has never been checked in ?
Oh addEventListenerByIID addref the listener :/
*** This bug has been marked as a duplicate of 129602 ***
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.