Bug 58029 - Web Inspector: update breakpoints according to source frame decorations after live edit.
Summary: Web Inspector: update breakpoints according to source frame decorations after...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Pavel Podivilov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-07 05:00 PDT by Pavel Podivilov
Modified: 2011-04-08 08:10 PDT (History)
11 users (show)

See Also:


Attachments
Patch. (5.36 KB, patch)
2011-04-07 05:01 PDT, Pavel Podivilov
pfeldman: review-
Details | Formatted Diff | Diff
Patch. (9.94 KB, patch)
2011-04-07 09:55 PDT, Pavel Podivilov
no flags Details | Formatted Diff | Diff
Patch. (10.27 KB, patch)
2011-04-08 02:58 PDT, Pavel Podivilov
pfeldman: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Podivilov 2011-04-07 05:00:24 PDT
Web Inspector: update breakpoints according to source frame decorations after live edit.

Currently, breakpoint decorations are moved accurately during the editing. But when user saves the result, breakpoints are moved in the model based on a text diff, which is not always accurate.
We should move breakpoints in the model based on decorations. Text diff should only be used as a fallback for "revert to revision" feature.
Comment 1 Pavel Podivilov 2011-04-07 05:01:05 PDT
Created attachment 88607 [details]
Patch.
Comment 2 Andrey Adaikin 2011-04-07 08:05:56 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=88607&action=review

> Source/WebCore/inspector/front-end/SourceFrame.js:905
> +                this._delegate.removeBreakpoint(lineNumber);

lineNumber -> Number(lineNumber), check other places too
Comment 3 Pavel Feldman 2011-04-07 08:48:14 PDT
Comment on attachment 88607 [details]
Patch.

Please rebaseline and add a test.
Comment 4 Pavel Podivilov 2011-04-07 09:55:24 PDT
Created attachment 88652 [details]
Patch.
Comment 5 Pavel Feldman 2011-04-07 11:28:11 PDT
Comment on attachment 88652 [details]
Patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=88652&action=review

> Source/WebCore/inspector/front-end/SourceFrame.js:909
> +                this._delegate.setBreakpoint(Number(lineNumber), breakpoint.condition, breakpoint.enabled);

It is not clear whether _updateBreakpointsAfterLiveEdit or this code should take care of breakpoint re-creation.
Comment 6 Andrey Adaikin 2011-04-08 00:20:59 PDT
View in context: https://bugs.webkit.org/attachment.cgi?id=88652&action=review

>> Source/WebCore/inspector/front-end/SourceFrame.js:909
>> +                this._delegate.setBreakpoint(Number(lineNumber), breakpoint.condition, breakpoint.enabled);
> 
> It is not clear whether _updateBreakpointsAfterLiveEdit or this code should take care of breakpoint re-creation.

Yes, I vote for the _updateBreakpointsAfterLiveEdit taking care of this. Note, that the (this._textModel.text !== newSource) condition may take quite a while on big data sources. Before this change, it was executed only if an error occurs.
Comment 7 Pavel Podivilov 2011-04-08 02:39:02 PDT
(In reply to comment #5)
> (From update of attachment 88652 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=88652&action=review
> 
> > Source/WebCore/inspector/front-end/SourceFrame.js:909
> > +                this._delegate.setBreakpoint(Number(lineNumber), breakpoint.condition, breakpoint.enabled);
> 
> It is not clear whether _updateBreakpointsAfterLiveEdit or this code should take care of breakpoint re-creation.

The only place where breakpoints are updated according to decorations is source frame's method _handleSave.
The only place where _updateBreakpointsAfterLiveEdit is called is revert callback in _updateResourceContent function (used by "revert to this revision").
These two cases can never be mixed.

> Yes, I vote for the _updateBreakpointsAfterLiveEdit taking care of this. Note, that the (this._textModel.text !== newSource) condition may take quite a while on big data sources. Before this change, it was executed only if an error occurs.

_updateBreakpointsAfterLiveEdit is a fallback used when we only have old text and new text. I'm not sure if (this._textModel.text !== newSource) may cause any trouble here. If it may, we should just freeze the content until editScriptSource response is received.
Comment 8 Pavel Podivilov 2011-04-08 02:58:26 PDT
Created attachment 88787 [details]
Patch.

As discussed offline, we should better freeze the content until editScriptSource response is recieved.
This is needed to avoid expensive (this._textModel.text !== newSource) check and potential bugs when new editing is started while previous one was not committed yet.
Comment 9 Pavel Podivilov 2011-04-08 08:10:51 PDT
Committed r83294: <http://trac.webkit.org/changeset/83294>