Open Bug 825383 Opened 13 years ago Updated 3 years ago

nsIEventListenerInfo: add a way to get the nsIDOMEventListener

Categories

(Core :: DOM: Events, defect, P5)

x86_64
Linux
defect

Tracking

()

People

(Reporter: Mook, Unassigned)

Details

nsIEventListenerService can take a nsIDOMEventTarget and give you a list of event listeners; however, you can't actually invoke them in any way, or compare them against a given listener, or even to remove it. All you can do is to get a JS debug object or a string of the JS source code. It would be nice to expose the nsIDOMEventListener on the nsIEventListenerInfo interface so you can do fun things with it. (This would mean exposing mListener from nsEventListenerInfo, pretty much. Just a simple readonly getter.)
The limitation is there very much on purpose.
It appears that the relevant bits are around bug 448602 comment 79, which basically sums up to "we don't trust that the XPCOM-wrapped listeners we get back, when called, will actually be called in the JS context that originally attached the listener". Past bugs of this type seems to deal with documents with no windows (e.g. from createDocument()). (I was planning on using this in places where there are no content listeners to deal with, but I can certainly appreciate not exposing a security footgun in the interface accessible to extensions.)
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.