Bug 52879

Summary: Web Inspector: refactor debugger api
Product: WebKit Reporter: Pavel Podivilov <podivilov>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Pavel Podivilov 2011-01-21 02:47:02 PST
The are two problems with setting breakpoints using our API:
1. Clients have to manage the list of sticky breakpoints and constantly call setStickyBreakpoints to sync that list with backend.
2. There is no way to set JavaScript breakpoint by url.


To fix the first problem, we should update sticky breakpoints on backend each time client calls set/remove breakpoint method.
Since we have two independent debugger agents (InspectorDebuggerAgent and InspectorBrowserDebuggerAgent), sticky breakpoints management should be implemented in both.

Client should have to sync all breakpoints just once at the beginning using the following methods:
[domain=Inspector] setAllJavaScriptBreakpoints(breakpoints)
[domain=Inspector] setAllBrowserBreakpoints(breakpoints)


To fix the second problem, JavaScript debugger API should allow setting breakpoint by both url and sourceID.
[domain=Debugger] setJavaScriptBreakpoint(url, lineNumber, condition, enabled, out breakpointId)
[domain=Debugger] setJavaScriptBreakpointBySourceID(sourceID, lineNumber, condition, enabled, out breakpointId)
[domain=Debugger] removeJavaScriptBreakpoint(breakpointId)
Comment 1 Ilya Tikhonovsky 2011-01-21 04:47:49 PST
(In reply to comment #0)
> The are two problems with setting breakpoints using our API:
> 1. Clients have to manage the list of sticky breakpoints and constantly call setStickyBreakpoints to sync that list with backend.
> 2. There is no way to set JavaScript breakpoint by url.
> 
> 
> To fix the first problem, we should update sticky breakpoints on backend each time client calls set/remove breakpoint method.
> Since we have two independent debugger agents (InspectorDebuggerAgent and InspectorBrowserDebuggerAgent), sticky breakpoints management should be implemented in both.
> 
> Client should have to sync all breakpoints just once at the beginning using the following methods:
> [domain=Inspector] setAllJavaScriptBreakpoints(breakpoints)
> [domain=Inspector] setAllBrowserBreakpoints(breakpoints)

if it is an inspector domain method then you can have single method and just skip the breakpoints which can't be set for some reason.
Also there is should be a notification or method about breakpoints statuses.


> To fix the second problem, JavaScript debugger API should allow setting breakpoint by both url and sourceID.
> [domain=Debugger] setJavaScriptBreakpoint(url, lineNumber, condition, enabled, out breakpointId)
> [domain=Debugger] setJavaScriptBreakpointBySourceID(sourceID, lineNumber, condition, enabled, out breakpointId)

It should be not an id but a structure with breakpoint info enough for persisting on front-end side.

> [domain=Debugger] removeJavaScriptBreakpoint(breakpointId)

ditto
Comment 2 Pavel Podivilov 2011-01-21 05:31:42 PST
(In reply to comment #1)
> (In reply to comment #0)
> > The are two problems with setting breakpoints using our API:
> > 1. Clients have to manage the list of sticky breakpoints and constantly call setStickyBreakpoints to sync that list with backend.
> > 2. There is no way to set JavaScript breakpoint by url.
> > 
> > 
> > To fix the first problem, we should update sticky breakpoints on backend each time client calls set/remove breakpoint method.
> > Since we have two independent debugger agents (InspectorDebuggerAgent and InspectorBrowserDebuggerAgent), sticky breakpoints management should be implemented in both.
> > 
> > Client should have to sync all breakpoints just once at the beginning using the following methods:
> > [domain=Inspector] setAllJavaScriptBreakpoints(breakpoints)
> > [domain=Inspector] setAllBrowserBreakpoints(breakpoints)
> 
> if it is an inspector domain method then you can have single method and just skip the breakpoints which can't be set for some reason.
> Also there is should be a notification or method about breakpoints statuses.
> 

I think we should better change the domain here:
[domain=Debugger] setAllJavaScriptBreakpoints(breakpoints)
[domain=BrowserDebugger] setAllBrowserBreakpoints(breakpoints)

> 
> > To fix the second problem, JavaScript debugger API should allow setting breakpoint by both url and sourceID.
> > [domain=Debugger] setJavaScriptBreakpoint(url, lineNumber, condition, enabled, out breakpointId)
> > [domain=Debugger] setJavaScriptBreakpointBySourceID(sourceID, lineNumber, condition, enabled, out breakpointId)
> 
> It should be not an id but a structure with breakpoint info enough for persisting on front-end side.
> 

Here input parameters are enough to persist breakpoint on front-end side, so returning breakpointId should be ok.

> > [domain=Debugger] removeJavaScriptBreakpoint(breakpointId)
> 
> ditto