Closed Bug 81835 Opened 25 years ago Closed 22 years ago

Need a way to add DOM event listeners

Categories

(Core Graveyard :: Embedding: APIs, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 129602
Future

People

(Reporter: galfandary, Assigned: adamlock)

Details

Attachments

(1 file)

Currently the only way to do this (AFAIK) is to go through private interfaces.
Target Milestone: --- → mozilla0.9.1
Status: UNCONFIRMED → NEW
Ever confirmed: true
Moving to 0.9.2 What kind of listeners do you intend to register? C++ or Javascript? Are you interested in listening to events bubbling up from subframes?
Target Milestone: mozilla0.9.1 → mozilla0.9.2
A mouse listener like the one used in TestGtkEmbed for example.
Target Milestone: mozilla0.9.2 → mozilla0.9.3
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.
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Target Milestone: mozilla0.9.4 → Future
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.
Downgrading
Severity: critical → major
Attached patch PatchSplinter Review
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
Attachment #113621 - Flags: superreview?(blizzard)
Attachment #113621 - Flags: review?(ccarlen)
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?
Attachment #113621 - Flags: superreview?(blizzard)
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: 22 years ago
Resolution: --- → DUPLICATE
Attachment #113621 - Flags: review?(ccarlen)
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: