Changeset 94674 in webkit
- Timestamp:
- Sep 7, 2011 9:42:00 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r94671 r94674 1 2011-09-06 Pavel Podivilov <podivilov@chromium.org> 2 3 Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode. 4 https://bugs.webkit.org/show_bug.cgi?id=67647 5 6 1) Implement RawSourceCode.setFormatted that allows toggling pretty-print mode on the fly without resetting everything. 7 2) Add RawSourceCode unit tests. 8 3) Remove source mapping listeners and console messages from presentation model (they live in RawSourceCode now). 9 10 Reviewed by Yury Semikhatsky. 11 12 * inspector/debugger/raw-source-code-expected.txt: Added. 13 * inspector/debugger/raw-source-code.html: Added. 14 * inspector/debugger/script-formatter.html: 15 * inspector/debugger/source-file.html: 16 1 17 2011-09-07 Alexander Pavlov <apavlov@chromium.org> 2 18 -
trunk/LayoutTests/inspector/debugger/script-formatter.html
r94571 r94674 186 186 { 187 187 dumpConsoleMessageURLs(); 188 panel._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCode Added, uiSourceCodeReplaced);188 panel._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, uiSourceCodeReplaced); 189 189 panel._toggleFormatSource(); 190 190 } -
trunk/LayoutTests/inspector/debugger/source-file.html
r93977 r94674 82 82 { 83 83 var script = new WebInspector.Script("1", "foo.js", 0, 0, 20, 80, undefined, undefined, false); 84 var rawSourceCode = new WebInspector.RawSourceCode("id", script, mockScriptFormatter, true);84 var rawSourceCode = new WebInspector.RawSourceCode("id", script, null, mockScriptFormatter, true); 85 85 86 86 function didCreateSourceMapping() … … 97 97 var script1 = new WebInspector.Script("1", "foo.js", 10, 20, 30, 40, undefined, undefined, false); 98 98 var script2 = new WebInspector.Script("2", "foo.js", 50, 60, 70, 80, undefined, undefined, false); 99 var rawSourceCode = new WebInspector.RawSourceCode("id", script1, mockScriptFormatter, true);99 var rawSourceCode = new WebInspector.RawSourceCode("id", script1, null, mockScriptFormatter, true); 100 100 rawSourceCode.addScript(script2); 101 101 -
trunk/Source/WebCore/ChangeLog
r94671 r94674 1 2011-09-06 Pavel Podivilov <podivilov@chromium.org> 2 3 Web Inspector: do not re-create RawSourceCode when toggling pretty-print mode. 4 https://bugs.webkit.org/show_bug.cgi?id=67647 5 6 1) Implement RawSourceCode.setFormatted that allows toggling pretty-print mode on the fly without resetting everything. 7 2) Add RawSourceCode unit tests. 8 3) Remove source mapping listeners and console messages from presentation model (they live in RawSourceCode now). 9 10 Reviewed by Yury Semikhatsky. 11 12 Test: inspector/debugger/raw-source-code.html 13 14 * inspector/front-end/DebuggerPresentationModel.js: 15 (WebInspector.DebuggerPresentationModel): 16 (WebInspector.DebuggerPresentationModel.prototype.linkifyLocation): 17 (WebInspector.DebuggerPresentationModel.prototype._addScript): 18 (WebInspector.DebuggerPresentationModel.prototype._sourceMappingUpdated): 19 (WebInspector.DebuggerPresentationModel.prototype.setFormatSource): 20 (WebInspector.DebuggerPresentationModel.prototype._createRawSourceCodeId): 21 (WebInspector.DebuggerPresentationModel.prototype._debuggerReset): 22 * inspector/front-end/ScriptsPanel.js: 23 (WebInspector.ScriptsPanel.prototype._toggleFormatSource): 24 * inspector/front-end/SourceFile.js: 25 (WebInspector.RawSourceCode): 26 (WebInspector.RawSourceCode.prototype.get uiSourceCode): 27 (WebInspector.RawSourceCode.prototype.setFormatted): 28 (WebInspector.RawSourceCode.prototype.rawLocationToUILocation): 29 (WebInspector.RawSourceCode.prototype._saveSourceMapping): 30 1 31 2011-09-07 Alexander Pavlov <apavlov@chromium.org> 2 32 -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r94571 r94674 38 38 this._rawSourceCode = {}; 39 39 this._messages = []; 40 // FIXME: move this to RawSourceCode when it's not re-created in pretty-print mode.41 this._sourceMappingListeners = [];42 40 43 41 this._presentationCallFrames = []; … … 99 97 }, 100 98 101 addSourceMappingListener: function(sourceURL, scriptId, listener)102 {103 this._sourceMappingListeners.push(listener);104 },105 106 removeSourceMappingListener: function(sourceURL, scriptId, listener)107 {108 // FIXME: implement this.109 },110 111 99 linkifyLocation: function(sourceURL, lineNumber, columnNumber, classes) 112 100 { … … 133 121 } 134 122 updateAnchor.call(this); 135 this.addSourceMappingListener(sourceURL, null, updateAnchor.bind(this));123 rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, updateAnchor, this); 136 124 return anchor; 137 125 }, … … 156 144 } 157 145 158 rawSourceCode = new WebInspector.RawSourceCode(rawSourceCodeId, script, this._formatter, this._formatSource); 146 var resource; 147 if (script.sourceURL) 148 resource = WebInspector.networkManager.inflightResourceForURL(script.sourceURL) || WebInspector.resourceForURL(script.sourceURL); 149 rawSourceCode = new WebInspector.RawSourceCode(rawSourceCodeId, script, resource, this._formatter, this._formatSource); 159 150 this._rawSourceCode[rawSourceCodeId] = rawSourceCode; 151 if (rawSourceCode.uiSourceCode) 152 this._updateSourceMapping(rawSourceCode, null); 160 153 rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._sourceMappingUpdated, this); 161 154 }, … … 163 156 _sourceMappingUpdated: function(event) 164 157 { 165 for (var i = 0; i < this._sourceMappingListeners.length; ++i)166 this._sourceMappingListeners[i]();167 168 158 var rawSourceCode = event.target; 169 159 var oldUISourceCode = event.data.oldUISourceCode; 160 this._updateSourceMapping(rawSourceCode, oldUISourceCode); 161 }, 162 163 _updateSourceMapping: function(rawSourceCode, oldUISourceCode) 164 { 170 165 var uiSourceCode = rawSourceCode.uiSourceCode; 171 166 … … 182 177 this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, eventData); 183 178 } 184 this._restoreBreakpoints(uiSourceCode); 185 }, 186 187 _restoreBreakpoints: function(uiSourceCode) 188 { 179 189 180 this._breakpointManager.uiSourceCodeAdded(uiSourceCode); 190 181 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode); … … 263 254 264 255 this._breakpointManager.reset(); 265 for (var id in this._rawSourceCode) 266 this._rawSourceCode[id].removeEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._sourceMappingUpdated, this); 267 this._rawSourceCode = {}; 256 257 for (var id in this._rawSourceCode) { 258 this._rawSourceCode[id].messages = []; 259 this._rawSourceCode[id].setFormatted(this._formatSource); 260 } 261 268 262 var messages = this._messages; 269 263 this._messages = []; 270 271 var scripts = WebInspector.debuggerModel.scripts;272 for (var id in scripts)273 this._addScript(scripts[id]);274 275 264 for (var i = 0; i < messages.length; ++i) 276 265 this._addConsoleMessage(messages[i]); 277 278 // FIXME: move this to RawSourceCode.279 for (var i = 0; i < this._sourceMappingListeners.length; ++i)280 this._sourceMappingListeners[i]();281 266 282 267 if (WebInspector.debuggerModel.callFrames) … … 447 432 _createRawSourceCodeId: function(sourceURL, scriptId) 448 433 { 449 var prefix = this._formatSource ? "deobfuscated:" : ""; 450 return prefix + (sourceURL || scriptId); 434 return sourceURL || scriptId; 451 435 }, 452 436 … … 455 439 this._rawSourceCode = {}; 456 440 this._messages = []; 457 this._sourceMappingListeners = [];458 441 this._presentationCallFrames = []; 459 442 this._selectedCallFrameIndex = 0; -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r94571 r94674 1133 1133 _toggleFormatSource: function() 1134 1134 { 1135 WebInspector.panels.scripts.reset();1136 1135 this._toggleFormatSourceButton.toggled = !this._toggleFormatSourceButton.toggled; 1137 1136 this._presentationModel.setFormatSource(this._toggleFormatSourceButton.toggled); -
trunk/Source/WebCore/inspector/front-end/SourceFile.js
r94571 r94674 36 36 * @extends {WebInspector.Object} 37 37 */ 38 WebInspector.RawSourceCode = function(id, script, formatter, formatted) 39 { 38 WebInspector.RawSourceCode = function(id, script, resource, formatter, formatted) 39 { 40 this.id = id; 41 this.url = script.sourceURL; 42 this.isContentScript = script.isContentScript; 40 43 this._scripts = [script]; 41 44 this._formatter = formatter; 42 45 this._formatted = formatted; 43 44 if (script.sourceURL) 45 this._resource = WebInspector.networkManager.inflightResourceForURL(script.sourceURL) || WebInspector.resourceForURL(script.sourceURL); 46 47 this.id = id; 48 this.url = script.sourceURL; 49 this.isContentScript = script.isContentScript; 46 this._resource = resource; 50 47 this.messages = []; 51 48 … … 71 68 get uiSourceCode() 72 69 { 73 // FIXME: extract UISourceCode from RawSourceCode (currently RawSourceCode implements methods from both interfaces). 74 return this; 75 }, 76 77 get rawSourceCode() 78 { 79 // FIXME: extract UISourceCode from RawSourceCode (currently RawSourceCode implements methods from both interfaces). 80 return this; 70 return this._uiSourceCode; 71 }, 72 73 setFormatted: function(formatted) 74 { 75 if (this._formatted === formatted) 76 return; 77 this._formatted = formatted; 78 this._updateSourceMapping(); 81 79 }, 82 80 … … 95 93 { 96 94 var location = this._mapping ? this._mapping.originalToFormatted(rawLocation) : rawLocation; 97 return new WebInspector.UILocation(this , location.lineNumber, location.columnNumber);95 return new WebInspector.UILocation(this.uiSourceCode, location.lineNumber, location.columnNumber); 98 96 }, 99 97 … … 121 119 }, 122 120 123 requestContent: function(callback)124 {125 // FIXME: remove this.126 this._uiSourceCode.requestContent(callback);127 },128 129 121 createSourceMappingIfNeeded: function(callback) 130 122 { … … 185 177 { 186 178 if (!this._formatted) { 187 setTimeout(callback.bind(null, originalContentProvider, null), 0);179 callback(originalContentProvider, null); 188 180 return; 189 181 } … … 203 195 _saveSourceMapping: function(contentProvider, mapping) 204 196 { 205 var oldUISourceCode; 206 if (this._uiSourceCode) 207 oldUISourceCode = this; 197 var oldUISourceCode = this._uiSourceCode; 208 198 var uiSourceCodeId = (this._formatted ? "deobfuscated:" : "") + (this._scripts[0].sourceURL || this._scripts[0].scriptId); 209 199 this._uiSourceCode = new WebInspector.UISourceCode(uiSourceCodeId, this.url, this.isContentScript, this, contentProvider);
Note: See TracChangeset
for help on using the changeset viewer.