Closed Bug 1559813 Opened 5 years ago Closed 2 years ago

Add ability to toggle event listeners in Inspector

Categories

(DevTools :: Inspector, enhancement, P3)

67 Branch
enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1492497

People

(Reporter: dev.lukaszpolowczyk, Assigned: nchevobbe)

References

(Blocks 2 open bugs)

Details

(Whiteboard: dt-webcompat)

Attachments

(1 file)

Attached image Inspector listener switcher.png (deleted) —

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0

Steps to reproduce:

Temporarily disable the listening of the event.

Actual results:

Czasami jest to niemożliwe albo trzeba pisać kod ręcznie w konsoli albo trzeba modyfikować kod źródłowy.

Sometimes it is impossible or you have to write the code manually in the console or you have to modify the source code.

Expected results:

Dodać "Event Listener Switcher" który pozwoli tymczasowo wyłączyć konkretny nasłuch wydarzenia.

Switcher może być w popupie po kliknięciu w znaczek "Obserwator zdarzeń" w Inspektorze w DevTools.

Add an "Event Listener Switcher" that will allow you to temporarily disable a specific event listen.

The Switcher can be in a popup after clicking the "Event Observer" badge in the Inspector in DevTools.

Type: defect → enhancement
Component: Untriaged → Inspector
Product: Firefox → DevTools

This sounds like a great idea. Thank you! I'll put it on the backlog for when we have time for it.
This may require collaboration with the Debugger.

One UX consideration which comes to mind is: how do we indicate that some event listeners are disabled without having to explicitly open the tooltip? We want to avoid confusing developers so we need a way to surface this information, particularly if we go with persistent toggles which survive a page refresh, like breakpoints do in the Debugger.

Priority: -- → P3
Summary: Add "Event Listener Switcher" in Inspector in DevTools → Add ability to toggle event listeners in Inspector

This is part of the Event Breakpoint project that a few people are currently working on. Let me ping Honza here.
Honza: there might be another bug for this already, is there?

Flags: needinfo?(odvarko)

I don't see such report in the current meta, so adding it there as dependency.

Honza

Flags: needinfo?(odvarko)
Severity: normal → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true

Some comments related to the implementation of this new feature:

  1. The popup window showing list of listeners registered for specific node is implemented as EventTooltip
    https://searchfox.org/mozilla-central/rev/42ae3bea104c37a9986c6f18d17bd9ddb387129c/devtools/client/shared/widgets/tooltip/EventTooltipHelper.js#35

  2. The list of event listeners (aka eventeListenersInfos) is collected using platform API nsIEventListenerService and nsIEventListenerInfo

The nsIEventListenerService offers add and remove methods, but using those might change order of the registered listener (adding a listener always at the end). What we need here is rather enable and disable specific listener methods.

@Olli - these APIs were originally implemented for Firebug in bug 448602
How complex would be to extend it with enable/disable (I am mostly interested in complexity/time estimate at this point)
So, we can use it to implement this suggested "Toogle on/off a listener" feature.

Honza

Flags: needinfo?(bugs)

Should be easy, like couple of hours.
Would it be ok to have API like
nsIEventListenerService.enableListener(in EventTarget aEventTarget, in nsIEventListenerInfo aInfo);
nsIEventListenerService.disableListener(in EventTarget aEventTarget, in nsIEventListenerInfo aInfo);
or do you have something else in mind?

Flags: needinfo?(bugs)

Yes, this is what I have in mind, enabling/disabling specific listener.
Thank you!

I decided to add 'enabled' property to the nsIEventListenerInfo.
Patch coming in a moment.

Whiteboard: dt-webcompat
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

Support for disabling/enabling event listeners has been introduced in bug 1492497, so we can close this one.

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: