Open Bug 923802 Opened 11 years ago Updated 2 years ago

Break on event listeners set from a blackboxed library

Categories

(DevTools :: Debugger, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: vporof, Unassigned)

References

(Blocks 1 open bug)

Details

STR:

1. Go to http://todomvc.com/architecture-examples/backbone/
2. Open debugger
3. Switch to the events tab
4. Check the "keypress" event type
5. Click on the "What needs to be done" input in the page and type something

Debugger should have paused. This is great. Moving on:

6. Resume (after this, debugger should stay resumed)
7. Blackbox jquery.js
8. Click again on the "What needs to be done" input in the page and type something

Nothing happens :(

This is pretty weird, since I'd imagine this to be a very pertinent use case in many scenarios. "I want to debug my event listener which I've added with a helper library, but I don't care about that library".

Ideally, the debugger should pause on the first called function that's outside of the blackboxed source.

Is this hard?
Flags: needinfo?(past)
Flags: needinfo?(nfitzgerald)
Blocks: 800857
Aside: Looking at _breakOnEnter, we should probably assert bp before accessing bp.actor, otherwise the assert is kind of pointless since if we don't have bp, we will throw before we can ever get to that assert.

Anyways, I think that we need to change _breakOnEnter to handle this. Maybe that just means passing another flag to the breakpoint actor that tells it to set an onEnterFrame hook for the next frame if it is black boxed.

The only tricky parts would be making sure we don't accidentally overwrite any existing onEnterFrame hooks, and that if we only move through black boxed frames while handling an event and return to the event loop, we won't accidentally break on the next unrelated frame we enter.
Flags: needinfo?(nfitzgerald)
Priority: -- → P3
What Nick said. Actually, I think a better implementation would be to make BA_hit behave properly if the breakpoint is a hidden one. Proper behavior in this case may be better achieved by setting another hidden breakpoint in the call frame instead of clobbering the onEnterFrame hook.
Flags: needinfo?(past)
Raising the priority as we are getting more requests to fix this now that the inspector displays events too.
Priority: P3 → P2
Summary: Blackboxing renders event listener breakpoints useless → Break on event listeners set from a blackboxed library
A couple of idea to improve this:

1. for events that are bound in blockboxed files, don't allow those events to be selected in the sidebar. Instead, don't allow them to be selected, and indicate somehow that they cannot be debugged because of blackboxing

2. for jquery events in particular, can we do something similar to visual events and break in the user's code instead of jquery?
Product: Firefox → DevTools
Priority: P2 → P3
Type: defect → enhancement
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.