Changeset 58477 in webkit
- Timestamp:
- Apr 28, 2010 11:10:03 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58476 r58477 1 2010-04-28 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: Allow editing script resources when resource tracking is enabled. 6 7 https://bugs.webkit.org/show_bug.cgi?id=38269 8 9 * inspector/front-end/ScriptView.js: 10 * inspector/front-end/ScriptsPanel.js: 11 (WebInspector.ScriptsPanel.prototype.canEditScripts): 12 (WebInspector.ScriptsPanel.prototype.editScriptSource): 13 * inspector/front-end/SourceFrame.js: 14 (WebInspector.SourceFrame.prototype.get textModel): 15 * inspector/front-end/SourceView.js: 16 (WebInspector.SourceView): 17 (WebInspector.SourceView.prototype._addBreakpoint): 18 (WebInspector.SourceView.prototype._editLine): 19 (WebInspector.SourceView.prototype._editLineComplete): 20 (WebInspector.SourceView.prototype._sourceIDForLine): 21 1 22 2010-04-25 Antonio Gomes <tonikitoo@webkit.org> 2 23 -
trunk/WebCore/inspector/front-end/ScriptView.js
r57909 r58477 78 78 }, 79 79 80 _editLine: function(line, newContent)81 {82 WebInspector.panels.scripts.editScriptLine(this.script.sourceID, line, newContent, this._editLineComplete.bind(this));83 },84 85 80 _editLineComplete: function(newBody) 86 81 { … … 108 103 _sourceFrameSetupFinished: WebInspector.SourceView.prototype._sourceFrameSetupFinished, 109 104 _removeBreakpoint: WebInspector.SourceView.prototype._removeBreakpoint, 105 _editLine: WebInspector.SourceView.prototype._editLine, 110 106 resize: WebInspector.SourceView.prototype.resize 111 107 } -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r58252 r58477 360 360 canEditScripts: function() 361 361 { 362 return !!InspectorBackend.editScript Line;363 }, 364 365 editScript Line: function(sourceID, line, newContent, callback)362 return !!InspectorBackend.editScriptSource; 363 }, 364 365 editScriptSource: function(sourceID, newContent, line, linesCountToShift, callback) 366 366 { 367 367 if (!this.canEditScripts()) … … 377 377 } 378 378 379 var linesCountToShift = newContent.split("\n").length - 1;380 379 function mycallback(newBody) 381 380 { … … 389 388 }; 390 389 var callbackId = WebInspector.Callback.wrap(mycallback.bind(this)) 391 InspectorBackend.editScript Line(callbackId, sourceID, line, newContent);390 InspectorBackend.editScriptSource(callbackId, sourceID, newContent); 392 391 }, 393 392 … … 1005 1004 WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype; 1006 1005 1007 WebInspector.didEditScript Line = WebInspector.Callback.processCallback;1006 WebInspector.didEditScriptSource = WebInspector.Callback.processCallback; -
trunk/WebCore/inspector/front-end/SourceFrame.js
r58252 r58477 153 153 }, 154 154 155 get textModel() 156 { 157 return this._textModel; 158 }, 159 155 160 highlightLine: function(line) 156 161 { -
trunk/WebCore/inspector/front-end/SourceView.js
r56444 r58477 33 33 this.element.addStyleClass("source"); 34 34 35 this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this)); 35 var canEditScripts = WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script; 36 this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null); 36 37 resource.addEventListener("finished", this._resourceLoadingFinished, this); 37 38 this._frameNeedsSetup = true; … … 105 106 106 107 _addBreakpoint: function(line) 108 { 109 var sourceID = this._sourceIDForLine(line); 110 if (WebInspector.panels.scripts) { 111 var breakpoint = new WebInspector.Breakpoint(this.resource.url, line, sourceID); 112 WebInspector.panels.scripts.addBreakpoint(breakpoint); 113 } 114 }, 115 116 _removeBreakpoint: function(breakpoint) 117 { 118 if (WebInspector.panels.scripts) 119 WebInspector.panels.scripts.removeBreakpoint(breakpoint); 120 }, 121 122 _editLine: function(line, newContent) 123 { 124 var lines = []; 125 var textModel = this.sourceFrame.textModel; 126 for (var i = 0; i < textModel.linesCount; ++i) { 127 if (i === line) 128 lines.push(newContent); 129 else 130 lines.push(textModel.line(i)); 131 } 132 133 var linesCountToShift = newContent.split("\n").length - 1; 134 WebInspector.panels.scripts.editScriptSource(this._sourceIDForLine(line), lines.join("\n"), line, linesCountToShift, this._editLineComplete.bind(this)); 135 }, 136 137 _editLineComplete: function(newBody) 138 { 139 this.sourceFrame.updateContent(newBody); 140 }, 141 142 _sourceIDForLine: function(line) 107 143 { 108 144 var sourceID = null; … … 116 152 } 117 153 } 118 119 if (WebInspector.panels.scripts) { 120 var breakpoint = new WebInspector.Breakpoint(this.resource.url, line, sourceID); 121 WebInspector.panels.scripts.addBreakpoint(breakpoint); 122 } 123 }, 124 125 _removeBreakpoint: function(breakpoint) 126 { 127 if (WebInspector.panels.scripts) 128 WebInspector.panels.scripts.removeBreakpoint(breakpoint); 154 return sourceID; 129 155 }, 130 156 -
trunk/WebKit/chromium/ChangeLog
r58425 r58477 1 2010-04-28 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: Allow editing script resources when resource tracking is enabled. 6 7 http://bugs.webkit.org/show_bug.cgi?id=38269 8 9 * src/js/DebuggerAgent.js: 10 * src/js/InspectorControllerImpl.js: 11 (.devtools.InspectorBackendImpl.prototype.setBreakpoint): 12 (.devtools.InspectorBackendImpl.prototype.editScriptSource): 13 1 14 2010-04-28 Darin Fisher <darin@chromium.org> 2 15 -
trunk/WebKit/chromium/src/js/DebuggerAgent.js
r58312 r58477 310 310 * Changes given line of the script. 311 311 */ 312 devtools.DebuggerAgent.prototype.editScriptLine = function(sourceId, line, newContent, callback) 313 { 314 var script = this.parsedScripts_[sourceId]; 315 if (!script || !script.source) 316 return; 317 318 var lines = script.source.split("\n"); 319 lines[line] = newContent; 320 312 devtools.DebuggerAgent.prototype.editScriptSource = function(sourceId, newContent, callback) 313 { 321 314 var commandArguments = { 322 315 "script_id": sourceId, 323 "new_source": lines.join("\n")316 "new_source": newContent 324 317 }; 325 318 -
trunk/WebKit/chromium/src/js/InspectorControllerImpl.js
r58413 r58477 139 139 140 140 141 devtools.InspectorBackendImpl.prototype.editScript Line = function(callID, sourceID, line, newContent)142 { 143 devtools.tools.getDebuggerAgent().editScript Line(sourceID, line, newContent, function(newFullBody) {144 WebInspector.didEditScript Line(callID, newFullBody);141 devtools.InspectorBackendImpl.prototype.editScriptSource = function(callID, sourceID, newContent) 142 { 143 devtools.tools.getDebuggerAgent().editScriptSource(sourceID, newContent, function(newFullBody) { 144 WebInspector.didEditScriptSource(callID, newFullBody); 145 145 }); 146 146 };
Note: See TracChangeset
for help on using the changeset viewer.