New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 646851 link

Starred by 5 users

Issue metadata

Status: Archived
Owner:
Closed: Dec 5
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Break on adding event listener

Project Member Reported by tdres...@chromium.org, Sep 14 2016

Issue description

Frequently I want to know when an event listener of a specific type was added. Currently you can break when an event listener of a specific type was executed.

Maybe in the "Event Listener Breakpoints" panel, you should be able to break on adding an event listener?

E.g.,

Touch:
  - touchstart
  - touchmove
  - touchend
  - touchcancel
  - register handler

Or something like that? Ideally you'd be able to specify which type of handler you want to monitor, but the UI there might be a bit tricky.
 
Labels: OS-All
Owner: kozyatinskiy@chromium.org
Status: Assigned (was: Untriaged)
Hi, I want to work on this issue. What about this ui?
register_handler_design.png
28.4 KB View Download
Cc: chowse@chromium.org
CC'ing @chowse our ux engineer; chris, any thoughts on the UI ahmet suggested?

Comment 4 by chowse@chromium.org, Sep 19 2016

Placing "Register handler" and "Remove handler" checkboxes beneath an event (e.g. "click") implies checking the event will also check its children (like checking "Mouse" checks all the events beneath it). This is probably not what people want when they check an event by default.


I'd propose 2 alternatives:

A) Use radio buttons instead of checkboxes, and provide 3 choices, e.g.:

   ▾ [-] Mouse
     ▸ [ ] click
     ▾ [X] mousemove
           (•) Event fired
           ( ) Listener added or removed
           ( ) Both

   Downside: this provides no way to create add/remove breakpoints at the top level,
   e.g. all mouse listeners.


B) Make the list a table, with columns representing the types of breakpoints:

                 | Fired | Added | Removed
   ▾ Mouse       |  [-]  |  [-]  |   [-]
       click     |  [ ]  |  [ ]  |   [ ]
       mousemove |  [X]  |  [X]  |   [X]
   
   This would allow creating Fired/Added/Removed breakpoints at any level.

   Downside: A lot more work.

Is it too complicated?
chris_suggestion_2.png
50.2 KB View Download

Comment 6 by rbyers@chromium.org, Sep 24 2016

Could we simplify this by just having a top-level button that toggles
between the "when fired", "when added/removed" and "both" modes for the
whole panel?  This is already a niche enough use case, I don't personally
see myself needing to break on add of one type of event AND break on fire
of another type at the same time.

Comment 7 by chowse@chromium.org, Sep 26 2016

I'd be okay with a top-level toggle. Just be sure to add it to the Event Listener heading, similar to the add/refresh controls on Watch.
#6 SGTM.
@chowse is this OK for you?
breakpoint_header_combo.jpg
70.5 KB View Download
Not bad. Some suggestions:

* Apparently the proper term for an event listener being called is "invoke", not
  "fire" (according to https://dom.spec.whatwg.org/#concept-event-listener-invoke).

* "Both" will not make much sense when the dropdown is closed. I'd change the
  options to the following:

    * When invoked
    * When modified
    * When invoked or modified

* Hide the dropdown when Event Listener Breakpoints is collapsed (I think this
  happens automatically in Canary)

* Is it possible to remove the space between the string and the triangle? The two
  look disconnected in that screenshot. 

Yes It will automatically hide when collapsed.I applied your suggestions.
breakpoint_header_modified.jpg
54.2 KB View Download
LGTM
Owner: kozy@chromium.org
Workaround: debug(Element.prototype.addEventListener, "arguments[0] === 'click'")
Status: Archived (was: Assigned)
Bulk-closing low priority bugs / feature requests with no action plan.

Sign in to add a comment