Open Bug 800858 Opened 12 years ago Updated 2 years ago

Break on specific functions

Categories

(DevTools :: Debugger, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: vporof, Unassigned)

References

(Blocks 1 open bug)

Details

I'm looking here at working on the suggestions in https://etherpad.mozilla.org/webgl-tools (lines ~120), but the implementation should be generalized enough to work with any api. WebGL and Canvas 2D methods for starters, but other deliciousness (for example geolocation etc.) would be nice to have as well.

This needs parser support, because just function names are not to be trusted.

The most awkward part is figuring out some nice UI for this. I guess that filterable menus/dropdowns would be ok, but I'd really love to find out a better way of doing this.

Breaking on DOM events is a whole different beast (i'm looking here at media playback handling too, drag-n-drop etc.). See bug 800857.
Depends on: 732442
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Priority: -- → P3
Depends on: 676602
Depends on: 762160
I just wanted to break on "showFlashPlayer" without knowing where it was located.
Without breakpoints column support (bug 676602) (or some clever way of breaking inside native code), this is going to be unuseful in many cases. There are too many cases in which such calls reside in minified sources.
Depends on: 568142
Waiting on bug 676602 first.
Status: ASSIGNED → NEW
Assignee: vporof → nobody
It would be great to have a "break" console command and be able to call it with ES, host or page function names - 

break encodeURIComponent
break Math.random
break document.write
break XMLHttpRequest.prototype.open

// page has function foobar(){} or var foobar = function(){}

break foobar

// page has o = {foo:function(){}}

break o.foo

Would it work to "wrap" the given method in a proxy method with a debugger statement? I guess we'll introduce confusing stack frames with such a simplistic approach :-/
(In reply to Hallvord R. M. Steen from comment #4)
> It would be great to have a "break" console command and be able to call it
> with ES, host or page function names - 
> 
> break encodeURIComponent
> break Math.random
> break document.write
> break XMLHttpRequest.prototype.open
> 
> // page has function foobar(){} or var foobar = function(){}
> 
> break foobar
> 
> // page has o = {foo:function(){}}
> 
> break o.foo
> 
> Would it work to "wrap" the given method in a proxy method with a debugger
> statement? I guess we'll introduce confusing stack frames with such a
> simplistic approach :-/

The developer toolbar has a break command now (Shift + F2 > "help break add") but it currently only supports line numbers. Would be nice to extend it to take function names.
Summary: Provide a way of breaking on specific functions → Break on specific functions
Product: Firefox → DevTools
Type: defect → enhancement
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.