Bug 40336

Summary: Web Inspector: add programmatic API for setting breakpoints
Product: WebKit Reporter: Jesse Hallett <hallettj>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: graouts, hallettj, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Jesse Hallett 2010-06-08 14:45:39 PDT
From time a bug comes up that I can only reproduce in a production environment.  This leads to debugging code that is minified and that I cannot change.  In situations like this it would be really helpful to be able to programmatically set breakpoints.  For example setting a property on a function from the console to cause execution to pause when that function starts running would be great:

    > filter._onPreProcess.debug = true;

It would also be handy to be able to set the value of that property to a predicate function so that execution would only pause if the predicate returned `true`:

    > filter._onPreProcess.debug = function(/* gets arguments sent to _onPreProcess() */) { return !!arguments[1].match(/foo/); };

There are also cases where I can modify where I believe it would be useful to have other breakpoint API options.  When debugging Ruby code with the Ruby debugger I can place a call to a function called `debugger()` in my code to cause execution to pause on that line.  It would be nice to have a similar option in Webkit.
Comment 1 Jesse Hallett 2010-06-08 15:00:37 PDT
I found out that you can use the `debugger;` statement for that latter case.
Comment 2 Brian Burg 2014-11-28 19:52:50 PST
This seems like a good candidate for the console command line. Firefox's GCLI (https://github.com/mozilla/gcli/) seems to have a similar interface.

There are significant challenges to making this visible to user scripts, so I think we should focus on something only made available through the inspector console.
Comment 3 Radar WebKit Bug Importer 2014-11-28 19:53:03 PST
<rdar://problem/19095011>