Bug 200233 - Web Inspector: DOM: provide a way to disable/breakpoint all event listeners for a given DOM node or event type
Summary: Web Inspector: DOM: provide a way to disable/breakpoint all event listeners f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Enhancement
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-29 11:46 PDT by Daniel Bates
Modified: 2019-08-01 14:38 PDT (History)
5 users (show)

See Also:


Attachments
Patch (17.40 KB, patch)
2019-07-30 16:00 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] After Patch is applied (141.95 KB, image/png)
2019-07-31 00:13 PDT, Devin Rousso
no flags Details
Patch (17.51 KB, patch)
2019-07-31 13:01 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2019-07-29 11:46:03 PDT
Today I wanted to quickly diagnose an issue on google.com on iOS, I needed to find the event listeners that was preventing two finger double tapping a link be recognized. Web Inspector lets me toggle individual event listeners for each event, but on google.com (and other sites) they frequently addEventListener() multiple handlers for the same event. It would be a time saver if I could enable/disable  or break on all event listeners for the same event. **My first thought is to recognize Option + clicking the Enable or Breakpoint checkbox for one event listener to toggle enabling or disabling the same checkbox on all event listeners for that event.**
Comment 1 Devin Rousso 2019-07-30 16:00:36 PDT
Created attachment 375191 [details]
Patch
Comment 2 Joseph Pecoraro 2019-07-30 19:00:40 PDT
This deserves a screenshot!
Comment 3 Devin Rousso 2019-07-31 00:13:08 PDT
Created attachment 375216 [details]
[Image] After Patch is applied
Comment 4 Joseph Pecoraro 2019-07-31 11:53:15 PDT
Comment on attachment 375191 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=375191&action=review

Nice! r=me

> Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js:82
> +        return !!InspectorBackend.domains.DOM && !!InspectorBackend.domains.DOM.setEventListenerDisabled;

This could be written as:

    return !!(InspectorBackend.domains.DOM && InspectorBackend.domains.DOM.setEventListenerDisabled)

To avoid too many !s

> Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js:87
> +        return !!InspectorBackend.domains.DOM && !!InspectorBackend.domains.DOM.setBreakpointForEventListener && !!InspectorBackend.domains.DOM.removeBreakpointForEventListener;

Ditto

> Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js:98
> +        return !!this._eventListener.eventListenerId;

Hmm, when does this happen? It seems that if this happens then the Gear menu will only ever show "Disable Event Listeners" because this one can not be disabled.
Comment 5 Devin Rousso 2019-07-31 12:58:21 PDT
Comment on attachment 375191 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=375191&action=review

>> Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js:98
>> +        return !!this._eventListener.eventListenerId;
> 
> Hmm, when does this happen? It seems that if this happens then the Gear menu will only ever show "Disable Event Listeners" because this one can not be disabled.

This is for compatibility, as `eventListenerId` was added within the last year.  If it's missing, we don't show the Gear menu at all.
Comment 6 Devin Rousso 2019-07-31 13:01:34 PDT
Created attachment 375238 [details]
Patch
Comment 7 WebKit Commit Bot 2019-07-31 13:43:39 PDT
Comment on attachment 375238 [details]
Patch

Clearing flags on attachment: 375238

Committed r248052: <https://trac.webkit.org/changeset/248052>
Comment 8 WebKit Commit Bot 2019-07-31 13:43:40 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2019-07-31 13:44:17 PDT
<rdar://problem/53778151>
Comment 10 Joseph Pecoraro 2019-07-31 13:49:20 PDT
> This is for compatibility, as `eventListenerId` was added within the last
> year.  If it's missing, we don't show the Gear menu at all.

Ohh, the makes sense thanks. This could use a COMPATIBILITY comment then.
Comment 11 Daniel Bates 2019-07-31 19:31:59 PDT
πŸ₯³πŸ₯‚πŸΈπŸΎπŸ»