Last Comment Bug 665933 - [highlighter] investigate showing elements listening to mouse & key events
: [highlighter] investigate showing elements listening to mouse & key events
Status: RESOLVED DUPLICATE of bug 1044932
:
Product: Firefox
Classification: Client Software
Component: Developer Tools: Inspector (show other bugs)
: unspecified
: x86 Linux
: -- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 736078
Blocks: 663830
  Show dependency treegraph
 
Reported: 2011-06-21 09:46 PDT by Paul Rouget [:paul]
Modified: 2015-06-30 21:52 PDT (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Opera 12.16 handle this in an elegant way (highlighted in yellow). (198.41 KB, image/png)
2013-07-05 04:34 PDT, Willian Gustavo Veiga
no flags Details

Description Paul Rouget [:paul] 2011-06-21 09:46:35 PDT
See http://www.sprymedia.co.uk/article/Visual+Event
Comment 1 Paul Rouget [:paul] 2011-06-22 02:55:41 PDT
Mike Ratcliffe suggested this:
> let eventListenerService =
> Components.classes["@mozilla.org/eventlistenerservice;1"]
> .getService(Components.interfaces.nsIEventListenerService);
> 
> let elt = content.document.getElementById(aNode.id);
> 
> eventListenerService .getListenerInfoFor(elt).getDebugObject();
> 
> I am fairly certain that this gives access to some useful event info
> ... the only problem is that the debugger needs to be running in
> order to use it.
Comment 2 Michael Ratcliffe [:miker] [:mratcliffe] 2011-06-22 06:12:17 PDT
The debugger doesn't need to be running if you only need to list the listeners attached to an element. You can use the following code for that:

let eventListenerService =
  Components.classes["@mozilla.org/eventlistenerservice;1"]
    .getService(Components.interfaces.nsIEventListenerService);
 
  let elt = content.document.getElementById(aNode.id); 
  let result = eventListenerService.getListenerInfoFor(elt);

If you want to do more than simply listing them then the debugger needs to be running.
Comment 3 Jan Honza Odvarko [:Honza] PTO 07/23 - 08/08 2011-06-22 06:51:37 PDT
See also following Firebug extension that uses nsIEventListenerService to display event handlers.

http://code.google.com/p/fbug/source/browse/#svn%2Feventbug%2Fbranches%2Feventbug0.1

Honza
Comment 4 Rob Campbell [:rc] (:robcee) 2012-11-02 08:00:28 PDT
still want something like this.
Comment 5 Willian Gustavo Veiga 2013-07-05 04:34:16 PDT
Created attachment 771594 [details]
Opera 12.16 handle this in an elegant way (highlighted in yellow).

On mouse over you can see all events types / handlers.
Comment 6 flying sheep 2013-12-18 02:09:33 PST
the firebug implementation lives in the following places.

https://github.com/firebug/firebug/blob/master/extension/content/firebug/lib/events.js#L588
https://github.com/firebug/firebug/blob/master/extension/content/firebug/console/commands/getEventListeners.js#L205

we could rip it out and put it into the web console, then use it to spice up the inspector
Comment 7 Paul Rouget [:paul] 2013-12-18 10:09:19 PST
(In reply to flying sheep from comment #6)
> the firebug implementation lives in the following places.
> 
> https://github.com/firebug/firebug/blob/master/extension/content/firebug/lib/
> events.js#L588
> https://github.com/firebug/firebug/blob/master/extension/content/firebug/
> console/commands/getEventListeners.js#L205
> 
> we could rip it out and put it into the web console, then use it to spice up
> the inspector

Thanks. elService being:

> let eventListenerService = Cc["@mozilla.org/eventlistenerservice;1"]
> .getService(Ci.nsIEventListenerService);
Comment 8 Panos Astithas [:past] 2013-12-18 10:38:58 PST
Or we could reuse the code in the debugger (maybe even move it to devtools/shared/).
Comment 9 flying sheep 2013-12-19 06:26:59 PST
(In reply to Panos Astithas [:past] from comment #8)
> Or we could reuse the code in the debugger

which lives where? (i’d like to create an extension like eventbug for the web console, so i’d like to see all prior art here for inspiration ☺)
Comment 10 Panos Astithas [:past] 2013-12-19 06:36:38 PST
The backend part which could be refactored to call a shared implementation is here:

http://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/script.js#1661

The main frontend part is here:

http://dxr.mozilla.org/mozilla-central/source/browser/devtools/debugger/debugger-controller.js#1414
Comment 11 flying sheep 2013-12-19 08:02:40 PST
thanks!
Comment 12 Patrick Brosset <:pbro> (PTO until August 16, not doing reviews) 2015-06-30 21:52:03 PDT
We've had event information in the inspector for a while now, I think since bug 1044932.

*** This bug has been marked as a duplicate of bug 1044932 ***

Note You need to log in before you can comment on or make changes to this bug.