Changeset 85320 in webkit
- Timestamp:
- Apr 29, 2011 6:06:01 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r85319 r85320 1 2011-04-28 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: include script end line:column in scriptParsed parameters. 6 https://bugs.webkit.org/show_bug.cgi?id=59717 7 8 * inspector/debugger/debugger-scripts-expected.txt: 9 * inspector/debugger/debugger-scripts.html: 10 1 11 2011-04-28 Yury Semikhatsky <yurys@chromium.org> 2 12 -
trunk/LayoutTests/inspector/debugger/debugger-scripts-expected.txt
r78535 r85320 3 3 Debugger was enabled. 4 4 script 1: 5 offset: 5:86 length: 10415 start: 5:8 6 end: 37:2 7 7 script 2: 8 offset: 38:21 9 length: 50 8 start: 38:21 9 end: 43:24 10 script 3: 11 start: 45:11 12 end: 45:32 13 script 4: 14 start: 46:11 15 end: 46:28 16 script 5: 17 start: 48:11 18 end: 49:20 10 19 Debugger was disabled. 11 20 -
trunk/LayoutTests/inspector/debugger/debugger-scripts.html
r78535 r85320 22 22 return; 23 23 scripts.push(script); 24 if (scripts.length === 2)24 if (scripts.length === 5) 25 25 step3(); 26 26 } … … 31 31 for (var i = 0; i < scripts.length; ++i) { 32 32 InspectorTest.addResult("script " + (i + 1) + ":"); 33 InspectorTest.addResult(" offset: " + scripts[i].lineOffset + ":" + scripts[i].columnOffset);34 InspectorTest.addResult(" length: " + scripts[i].length);33 InspectorTest.addResult(" start: " + scripts[i].lineOffset + ":" + scripts[i].columnOffset); 34 InspectorTest.addResult(" end: " + scripts[i].endLine + ":" + scripts[i].endColumn); 35 35 } 36 36 InspectorTest.completeDebuggerTest(); … … 38 38 } 39 39 </script> <script> 40 function doStuff()40 function f1() 41 41 { 42 42 } 43 43 44 window.onload = runTest; 44 window.onload = runTest;</script> 45 46 <script> function f2() {} </script> 47 <script>function f3() {} 48 </script> 49 <script> 50 function f4() {} 45 51 </script> 46 52 -
trunk/Source/WebCore/ChangeLog
r85319 r85320 1 2011-04-28 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: include script end line:column in scriptParsed parameters. 6 https://bugs.webkit.org/show_bug.cgi?id=59717 7 8 * bindings/js/ScriptDebugServer.cpp: 9 (WebCore::ScriptDebugServer::dispatchDidParseSource): 10 * bindings/v8/DebuggerScript.js: 11 (): 12 * bindings/v8/ScriptDebugServer.cpp: 13 (WebCore::ScriptDebugServer::dispatchDidParseSource): 14 * inspector/Inspector.json: 15 * inspector/InspectorDebuggerAgent.cpp: 16 (WebCore::InspectorDebuggerAgent::resolveBreakpoint): 17 (WebCore::InspectorDebuggerAgent::didParseSource): 18 * inspector/InspectorDebuggerAgent.h: 19 (WebCore::InspectorDebuggerAgent::Script::Script): 20 * inspector/ScriptDebugListener.h: 21 * inspector/front-end/DebuggerModel.js: 22 (WebInspector.DebuggerModel.prototype._parsedScriptSource): 23 (WebInspector.DebuggerModel.prototype._failedToParseScriptSource): 24 (WebInspector.DebuggerDispatcher.prototype.scriptParsed): 25 * inspector/front-end/Script.js: 26 (WebInspector.Script): 27 1 28 2011-04-28 Yury Semikhatsky <yurys@chromium.org> 2 29 -
trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp
r85035 r85320 226 226 int columnOffset = sourceProvider->startPosition().m_column.convertAsZeroBasedInt(); 227 227 228 int lineCount = 1; 229 int lastLineStart = 0; 230 for (size_t i = 0; i < data.length() - 1; ++i) { 231 if (data[i] == '\n') { 232 lineCount += 1; 233 lastLineStart = i + 1; 234 } 235 } 236 237 int endLine = lineOffset + lineCount - 1; 238 int endColumn; 239 if (lineCount == 1) 240 endColumn = data.length() + columnOffset; 241 else 242 endColumn = data.length() - lastLineStart; 243 228 244 Vector<ScriptDebugListener*> copy; 229 245 copyToVector(listeners, copy); 230 246 for (size_t i = 0; i < copy.size(); ++i) 231 copy[i]->didParseSource(sourceID, url, data, lineOffset, columnOffset, isContentScript);247 copy[i]->didParseSource(sourceID, url, data, lineOffset, columnOffset, endLine, endColumn, isContentScript); 232 248 } 233 249 -
trunk/Source/WebCore/bindings/v8/DebuggerScript.js
r83874 r85320 87 87 DebuggerScript._formatScript = function(script) 88 88 { 89 var lineEnds = script.line_ends; 90 var lineCount = lineEnds.length; 91 var endLine = script.line_offset + lineCount - 1; 92 var endColumn; 93 if (lineCount === 1) 94 endColumn = script.source.length + script.column_offset; 95 else 96 endColumn = script.source.length - (script.line_ends[lineCount - 2] + 1); 97 89 98 return { 90 99 id: script.id, 91 100 name: script.nameOrSourceURL(), 92 101 source: script.source, 93 lineOffset: script.line_offset, 94 columnOffset: script.column_offset, 102 startLine: script.line_offset, 103 startColumn: script.column_offset, 104 endLine: endLine, 105 endColumn: endColumn, 95 106 isContentScript: !!script.context_data && script.context_data.indexOf("injected") == 0 96 107 }; -
trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp
r85035 r85320 357 357 toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("name"))), 358 358 toWebCoreStringWithNullOrUndefinedCheck(object->Get(v8::String::New("source"))), 359 object->Get(v8::String::New("lineOffset"))->ToInteger()->Value(), 360 object->Get(v8::String::New("columnOffset"))->ToInteger()->Value(), 359 object->Get(v8::String::New("startLine"))->ToInteger()->Value(), 360 object->Get(v8::String::New("startColumn"))->ToInteger()->Value(), 361 object->Get(v8::String::New("endLine"))->ToInteger()->Value(), 362 object->Get(v8::String::New("endColumn"))->ToInteger()->Value(), 361 363 object->Get(v8::String::New("isContentScript"))->ToBoolean()->Value()); 362 364 } -
trunk/Source/WebCore/inspector/Inspector.json
r85319 r85320 1473 1473 { "name": "sourceID", "type": "string", "description": "Identifier of the script parsed." }, 1474 1474 { "name": "url", "type": "string", "description": "URL of the script parsed (if any)." }, 1475 { "name": "lineOffset", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, 1476 { "name": "columnOffset", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, 1477 { "name": "length", "type": "integer", "description": "Length of the script" }, 1475 { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, 1476 { "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, 1477 { "name": "endLine", "type": "integer", "description": "Last line of the script." }, 1478 { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, 1478 1479 { "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." } 1479 1480 ], -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
r85319 r85320 249 249 return 0; 250 250 Script& script = scriptIterator->second; 251 if (breakpoint.lineNumber < script.lineOffset) 252 return 0; 253 if (!script.linesCount) { 254 script.linesCount = 1; 255 for (size_t i = 0; i < script.data.length(); ++i) { 256 if (script.data[i] == '\n') 257 script.linesCount += 1; 258 } 259 } 260 if (breakpoint.lineNumber >= script.lineOffset + script.linesCount) 251 if (breakpoint.lineNumber < script.startLine || script.endLine <= breakpoint.lineNumber) 261 252 return 0; 262 253 … … 377 368 // JavaScriptDebugListener functions 378 369 379 void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, bool isContentScript)370 void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String& url, const String& data, int startLine, int startColumn, int endLine, int endColumn, bool isContentScript) 380 371 { 381 372 // Don't send script content to the front end until it's really needed. 382 m_frontend->scriptParsed(sourceID, url, lineOffset, columnOffset, data.length(), isContentScript);383 384 m_scripts.set(sourceID, Script(url, data, lineOffset, columnOffset));373 m_frontend->scriptParsed(sourceID, url, startLine, startColumn, endLine, endColumn, isContentScript); 374 375 m_scripts.set(sourceID, Script(url, data, startLine, startColumn, endLine, endColumn)); 385 376 386 377 if (url.isEmpty()) -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h
r85319 r85320 121 121 PassRefPtr<InspectorArray> currentCallFrames(); 122 122 123 virtual void didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, bool isContentScript);123 virtual void didParseSource(const String& sourceID, const String& url, const String& data, int startLine, int startColumn, int endLine, int endColumn, bool isContentScript); 124 124 virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); 125 125 virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception); … … 132 132 public: 133 133 Script() 134 : lineOffset(0) 135 , columnOffset(0) 136 , linesCount(0) 134 : startLine(0) 135 , startColumn(0) 136 , endLine(0) 137 , endColumn(0) 137 138 { 138 139 } 139 140 140 Script(const String& url, const String& data, int lineOffset, int columnOffset)141 Script(const String& url, const String& data, int startLine, int startColumn, int endLine, int endColumn) 141 142 : url(url) 142 143 , data(data) 143 , lineOffset(lineOffset) 144 , columnOffset(columnOffset) 145 , linesCount(0) 144 , startLine(startLine) 145 , startColumn(startColumn) 146 , endLine(endLine) 147 , endColumn(endColumn) 146 148 { 147 149 } … … 149 151 String url; 150 152 String data; 151 int lineOffset; 152 int columnOffset; 153 int startLine; 154 int startColumn; 155 int endLine; 156 int endColumn; 153 157 int linesCount; 154 158 }; -
trunk/Source/WebCore/inspector/ScriptDebugListener.h
r85035 r85320 43 43 virtual ~ScriptDebugListener() { } 44 44 45 virtual void didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, bool isContentScript) = 0;45 virtual void didParseSource(const String& sourceID, const String& url, const String& data, int startLine, int startColumn, int endLine, int endColumn, bool isContentScript) = 0; 46 46 virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0; 47 47 virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception) = 0; -
trunk/Source/WebCore/inspector/front-end/DebuggerModel.js
r83601 r85320 180 180 }, 181 181 182 _parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, isContentScript)183 { 184 var script = new WebInspector.Script(sourceID, sourceURL, lineOffset, columnOffset, length, undefined, undefined, isContentScript);182 _parsedScriptSource: function(sourceID, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript) 183 { 184 var script = new WebInspector.Script(sourceID, sourceURL, startLine, startColumn, endLine, endColumn, undefined, undefined, isContentScript); 185 185 this._scripts[sourceID] = script; 186 186 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, script); … … 189 189 _failedToParseScriptSource: function(sourceURL, source, startingLine, errorLine, errorMessage) 190 190 { 191 var script = new WebInspector.Script(null, sourceURL, startingLine, errorLine, errorMessage, undefined);191 var script = new WebInspector.Script(null, sourceURL, startingLine, 0, 0, 0, errorLine, errorMessage, undefined); 192 192 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, script); 193 193 } … … 228 228 }, 229 229 230 scriptParsed: function(sourceID, sourceURL, lineOffset, columnOffset, length, isContentScript)231 { 232 this._debuggerModel._parsedScriptSource(sourceID, sourceURL, lineOffset, columnOffset, length, isContentScript);230 scriptParsed: function(sourceID, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript) 231 { 232 this._debuggerModel._parsedScriptSource(sourceID, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript); 233 233 }, 234 234 -
trunk/Source/WebCore/inspector/front-end/Script.js
r83601 r85320 24 24 */ 25 25 26 WebInspector.Script = function(sourceID, sourceURL, lineOffset, columnOffset, length, errorLine, errorMessage, isContentScript)26 WebInspector.Script = function(sourceID, sourceURL, startLine, startColumn, endLine, endColumn, errorLine, errorMessage, isContentScript) 27 27 { 28 28 this.sourceID = sourceID; 29 29 this.sourceURL = sourceURL; 30 this.lineOffset = lineOffset; 31 this.columnOffset = columnOffset; 32 this.length = length; 30 this.lineOffset = startLine; 31 this.columnOffset = startColumn; 32 this.endLine = endLine; 33 this.endColumn = endColumn; 33 34 this.errorLine = errorLine; 34 35 this.errorMessage = errorMessage;
Note: See TracChangeset
for help on using the changeset viewer.