Bug 54544 - Web Inspector: show all inlined scripts from single document in the same source frame
Summary: Web Inspector: show all inlined scripts from single document in the same sour...
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-02-16 03:47 PST by Pavel Podivilov
Modified: 2011-02-17 04:08 PST (History)
10 users (show)

See Also:


Attachments
Patch. (16.26 KB, patch)
2011-02-16 03:49 PST, Pavel Podivilov
yurys: review-
Details | Formatted Diff | Diff
Patch. (26.46 KB, patch)
2011-02-16 07:32 PST, Pavel Podivilov
no flags Details | Formatted Diff | Diff
Patch. (26.47 KB, patch)
2011-02-16 07:47 PST, Pavel Podivilov
yurys: 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-02-16 03:47:59 PST
Web Inspector: show all inlined scripts from single document in the same source frame.

Currently when debugging synchronously executed inlined scripts each script is shown in it's own source frame ("example.html:24").
We should show such scripts in the same source frame "example.html" with <script></script> framing.
Comment 1 Pavel Podivilov 2011-02-16 03:49:58 PST
Created attachment 82611 [details]
Patch.
Comment 2 Yury Semikhatsky 2011-02-16 04:37:33 PST
Comment on attachment 82611 [details]
Patch.

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

> Source/WebCore/inspector/front-end/ScriptsPanel.js:264
> +        var sourceName = script.sourceURL || script.sourceID;

You are passing sourceID while _recreateSourceFrame uses it for lookup in _urlToSource... These two types of ids shouldn't be mixed.

> Source/WebCore/inspector/front-end/ScriptsPanel.js:531
> +        var isScript = !script.lineOffset && !script.columnOffset;

Will this code work correctly with JSC when columnOffset is always 0 and lineOffset may well be 0 for inline script.

> Source/WebCore/inspector/front-end/ScriptsPanel.js:1080
> +        var lineNumber = 0, columnNumber = 0;

Each statement should go on a separate line.
Comment 3 Pavel Podivilov 2011-02-16 07:32:47 PST
Created attachment 82634 [details]
Patch.
Comment 4 Pavel Podivilov 2011-02-16 07:41:25 PST
(In reply to comment #2)
> (From update of attachment 82611 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=82611&action=review
> 
> > Source/WebCore/inspector/front-end/ScriptsPanel.js:264
> > +        var sourceName = script.sourceURL || script.sourceID;
> 
> You are passing sourceID while _recreateSourceFrame uses it for lookup in _urlToSource... These two types of ids shouldn't be mixed.
> 
sourceID is used as source name for scripts without sourceURL. This is private implementation detail of ScriptsPanel, and it considerably simplifies source frames management.
Renamed _urlToSourceFrame to _sourceNameToSourceFrame to avoid confusion.

> > Source/WebCore/inspector/front-end/ScriptsPanel.js:531
> > +        var isScript = !script.lineOffset && !script.columnOffset;
> 
> Will this code work correctly with JSC when columnOffset is always 0 and lineOffset may well be 0 for inline script.

JSC provides correct columnOffset, as ensured by inspector/debugger/debugger-scripts.html test.

> 
> > Source/WebCore/inspector/front-end/ScriptsPanel.js:1080
> > +        var lineNumber = 0, columnNumber = 0;
> 
> Each statement should go on a separate line.
Could you please clarify? 
The idea was to build source frame content with script tags at the same locations as in actual resource. Please check debug-inlined-scripts test expectations for example.
Comment 5 Pavel Podivilov 2011-02-16 07:47:29 PST
Created attachment 82635 [details]
Patch.
Comment 6 Pavel Podivilov 2011-02-16 07:47:57 PST
> Each statement should go on a separate line.
Done.
Comment 7 Ilya Tikhonovsky 2011-02-16 09:50:00 PST
View in context: https://bugs.webkit.org/attachment.cgi?id=82635&action=review

> Source/WebCore/inspector/front-end/ScriptsPanel.js:429
> +        this._sourceNameToFilesSelectOption = {};

Why you create another mapping from sourceName to something instead of a single map with complex objects.
Comment 8 Pavel Podivilov 2011-02-16 11:08:48 PST
(In reply to comment #7)
> View in context: https://bugs.webkit.org/attachment.cgi?id=82635&action=review
> 
> > Source/WebCore/inspector/front-end/ScriptsPanel.js:429
> > +        this._sourceNameToFilesSelectOption = {};
> 
> Why you create another mapping from sourceName to something instead of a single map with complex objects.

I don't see any benefits in merging these mappings together. They are never modified together, so the code is cleaner when mappings are separated.
Comment 9 Pavel Podivilov 2011-02-17 04:08:46 PST
Committed r78808: <http://trac.webkit.org/changeset/78808>