(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.
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.
Created attachment 49326 [details] [PATCH] Proposed fix.
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.
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