Bug 35232 - Web Inspector: Scripts panel shows blank source when stopping on a breakpoint on refresh.
Summary: Web Inspector: Scripts panel shows blank source when stopping on a breakpoint...
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 Feldman
URL: http://testsuites.opera.com/JSON/corr...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-22 03:19 PST by Pavel Feldman
Modified: 2010-02-25 05:45 PST (History)
5 users (show)

See Also:


Attachments
[PATCH] Proposed fix. (21.12 KB, patch)
2010-02-23 14:17 PST, Pavel Feldman
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Feldman 2010-02-22 03:19:06 PST
(Follow up to https://bugs.webkit.org/show_bug.cgi?id=28799)

I was thinking of a change that prevents scripts from being bound to resources prior to the resource's finished event and it works fine for secondary resources (external scripts). For main resource it would show multiple chunks of script tags first, and, once resource is loaded, it should replace chunks with the resource itself. Besides merging script entries upon resource finished event, there is a problem with chunks having 1-based lines numbering. It all breaks breakpoints.
Comment 1 Pavel Feldman 2010-02-22 03:21:12 PST
Steps to repro:
1. go to http://testsuites.opera.com/JSON/correctness/004.html
2. enable the debugger
3. set a breakpoint somewhere in the code of 004.js
4. reload the page

Result:
004.js is sometimes shown with empty content.
Comment 2 Pavel Feldman 2010-02-23 14:17:37 PST
Created attachment 49326 [details]
[PATCH] Proposed fix.
Comment 3 Timothy Hatcher 2010-02-23 17:45:26 PST
Comment on attachment 49326 [details]
[PATCH] Proposed fix.


> +        var prefix = [];
> +        for (var i = 0; i < this.script.startingLine; ++i)
> +            prefix.push("");
> +        
> +        this.sourceFrame.setContent("text/javascript", prefix.join("\n") + this.script.source);

Why not just build a string by appending "\n"? I think JSC optimizes that case.


> +            this._resourceForURLInFilesSelect[script.resource.url] = script.resource;
> +       }
> + 
> +        var displayName = script.sourceURL ? WebInspector.displayNameForURL(script.sourceURL) : WebInspector.UIString("(program)");

Bad indent on the } line.
Comment 4 Pavel Feldman 2010-02-25 05:45:45 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/inspector/front-end/Panel.js
	M	WebCore/inspector/front-end/ResourcesPanel.js
	M	WebCore/inspector/front-end/Script.js
	M	WebCore/inspector/front-end/ScriptView.js
	M	WebCore/inspector/front-end/ScriptsPanel.js
	M	WebCore/inspector/front-end/SourceView.js
	M	WebCore/inspector/front-end/inspector.js
Committed r55231