Changeset 112236 in webkit
- Timestamp:
- Mar 27, 2012 2:55:18 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r112233 r112236 1 2012-03-26 Pavel Podivilov <podivilov@chromium.org> 2 3 Web Inspector: store UIBreakpoints on UISourceCode. 4 https://bugs.webkit.org/show_bug.cgi?id=82214 5 6 Reviewed by Vsevolod Vlasov. 7 8 * inspector/debugger/breakpoint-manager.html: 9 1 10 2012-03-27 Szilard Ledan <szledan@inf.u-szeged.hu> 2 11 -
trunk/LayoutTests/inspector/debugger/breakpoint-manager.html
r111595 r112236 59 59 serializedBreakpoints.push(createBreakpoint("b.js", 3, "", true)); 60 60 61 function createUISourceCode(id, url) { return { id: id, url: url }; }61 function createUISourceCode(id, url) { return new WebInspector.UISourceCodeImpl(id, url, null); } 62 62 var uiSourceCodeA = createUISourceCode("a.js", "a.js"); 63 63 var uiSourceCodeB = createUISourceCode("b.js", "b.js"); -
trunk/Source/WebCore/ChangeLog
r112235 r112236 1 2012-03-26 Pavel Podivilov <podivilov@chromium.org> 2 3 Web Inspector: store UIBreakpoints on UISourceCode. 4 https://bugs.webkit.org/show_bug.cgi?id=82214 5 6 This change will allow us to make breakpoint-added and breakpoint-removed events a part of UISourceCode interface. 7 See bug 82224 for more details. 8 9 Reviewed by Vsevolod Vlasov. 10 11 * inspector/front-end/BreakpointManager.js: 12 (WebInspector.BreakpointManager.prototype.uiSourceCodeRemoved): 13 (WebInspector.BreakpointManager.prototype.setBreakpoint): 14 (WebInspector.BreakpointManager.prototype.removeBreakpoint): 15 (WebInspector.BreakpointManager.prototype._addBreakpointToUI): 16 (WebInspector.BreakpointManager.prototype._removeBreakpointFromUI): 17 (WebInspector.BreakpointManager.prototype.debuggerReset): 18 * inspector/front-end/CompilerScriptMapping.js: 19 (WebInspector.CompilerScriptMapping.prototype.addScript): 20 * inspector/front-end/DebuggerPresentationModel.js: 21 (WebInspector.DebuggerPresentationModel.prototype._updateBreakpointsAfterLiveEdit): 22 (WebInspector.DebuggerPresentationModel.prototype.breakpointsForUISourceCode): 23 (WebInspector.DebuggerPresentationModel.prototype.findBreakpoint): 24 (WebInspector.UISourceCodeImpl): 25 (WebInspector.UISourceCodeImpl.prototype.breakpoints): 26 (WebInspector.UISourceCodeImpl.prototype.breakpointAdded): 27 (WebInspector.UISourceCodeImpl.prototype.breakpointRemoved): 28 * inspector/front-end/RawSourceCode.js: 29 (WebInspector.RawSourceCode.prototype._createUISourceCode): 30 * inspector/front-end/SnippetsModel.js: 31 (WebInspector.SnippetsScriptMapping.prototype._snippetAdded): 32 (WebInspector.SnippetsScriptMapping.prototype._createUISourceCodeForScript): 33 * inspector/front-end/UISourceCode.js: 34 (WebInspector.UISourceCode.prototype.get domain): 35 (WebInspector.UISourceCode.prototype.get folderName): 36 (WebInspector.UISourceCode.prototype.get fileName): 37 (WebInspector.UISourceCode.prototype.get displayName): 38 (WebInspector.UISourceCode.prototype._parseURL): 39 (WebInspector.UISourceCode.prototype._didRequestContent): 40 (WebInspector.UISourceCode.prototype.breakpoints): 41 * inspector/front-end/inspector.html: 42 1 43 2012-03-27 Nat Duca <nduca@chromium.org> 2 44 -
trunk/Source/WebCore/inspector/front-end/BreakpointManager.js
r111595 r112236 42 42 this._breakpointAddedDelegate = breakpointAddedDelegate; 43 43 this._breakpointRemovedDelegate = breakpointRemovedDelegate; 44 /** 45 * @type Map} 46 */ 47 this._uiBreakpointsByUILocation = new Map(); 44 48 45 /** 49 46 * @type {Object.<string, Object.<string,WebInspector.Breakpoint>>} … … 89 86 uiSourceCodeRemoved: function(uiSourceCode) 90 87 { 91 var uiBreakpoints = this._uiBreakpoints(uiSourceCode);88 var uiBreakpoints = uiSourceCode.breakpoints(); 92 89 for (var lineNumber in uiBreakpoints) { 93 90 var uiBreakpoint = uiBreakpoints[lineNumber]; … … 98 95 /** 99 96 * @param {WebInspector.UISourceCode} uiSourceCode 100 * @return {Object.<string,WebInspector.UIBreakpoint>|undefined}101 */102 breakpointsForUISourceCode: function(uiSourceCode)103 {104 return this._uiBreakpoints(uiSourceCode);105 },106 107 /**108 * @param {WebInspector.UISourceCode} uiSourceCode109 97 * @param {number} lineNumber 110 98 * @param {string} condition … … 113 101 setBreakpoint: function(uiSourceCode, lineNumber, condition, enabled) 114 102 { 115 if ( this._uiBreakpoint(uiSourceCode, lineNumber))103 if (uiSourceCode.breakpoints()[lineNumber]) 116 104 return; 117 105 var breakpoint = new WebInspector.Breakpoint(uiSourceCode.id, lineNumber, condition, enabled, !!uiSourceCode.url); … … 127 115 removeBreakpoint: function(uiSourceCode, lineNumber) 128 116 { 129 var uiBreakpoint = this._uiBreakpoint(uiSourceCode, lineNumber);117 var uiBreakpoint = uiSourceCode.breakpoints()[lineNumber]; 130 118 if (!uiBreakpoint) 131 119 return; … … 205 193 206 194 /** 207 * @param {WebInspector.UISourceCode} uiSourceCode208 * @return {?Object.<string,WebInspector.UIBreakpoint>}209 */210 _uiBreakpoints: function(uiSourceCode)211 {212 if (!this._uiBreakpointsByUILocation.get(uiSourceCode))213 this._uiBreakpointsByUILocation.put(uiSourceCode, {});214 return this._uiBreakpointsByUILocation.get(uiSourceCode);215 },216 217 /**218 * @param {WebInspector.UISourceCode} uiSourceCode219 * @param {number} lineNumber220 * @return {?WebInspector.UIBreakpoint}221 */222 _uiBreakpoint: function(uiSourceCode, lineNumber)223 {224 return this._uiBreakpoints(uiSourceCode)[String(lineNumber)];225 },226 227 /**228 195 * @param {WebInspector.Breakpoint} breakpoint 229 196 * @param {WebInspector.UISourceCode} uiSourceCode … … 232 199 { 233 200 var uiBreakpoint = breakpoint.createUIBreakpoint(uiSourceCode); 234 console.assert(! this._uiBreakpoint(uiBreakpoint.uiSourceCode, uiBreakpoint.lineNumber));235 this._uiBreakpoints(uiBreakpoint.uiSourceCode)[uiBreakpoint.lineNumber] = uiBreakpoint;201 console.assert(!uiSourceCode.breakpoints()[uiBreakpoint.lineNumber]); 202 uiSourceCode.breakpointAdded(uiBreakpoint.lineNumber, uiBreakpoint); 236 203 this._breakpointAddedDelegate(uiBreakpoint); 237 204 }, … … 242 209 _removeBreakpointFromUI: function(uiBreakpoint) 243 210 { 244 console.assert(this._uiBreakpoint(uiBreakpoint.uiSourceCode, uiBreakpoint.lineNumber) === uiBreakpoint); 245 delete this._uiBreakpoints(uiBreakpoint.uiSourceCode)[uiBreakpoint.lineNumber]; 211 var uiSourceCode = uiBreakpoint.uiSourceCode; 212 var lineNumber = uiBreakpoint.lineNumber; 213 console.assert(uiSourceCode.breakpoints()[lineNumber] === uiBreakpoint); 214 uiSourceCode.breakpointRemoved(lineNumber); 246 215 uiBreakpoint.breakpoint.removeUIBreakpoint(); 247 216 this._breakpointRemovedDelegate(uiBreakpoint); … … 417 386 delete this._breakpointsByUILocation[id]; 418 387 } 419 this._uiBreakpointsByUILocation = new Map();420 388 } 421 389 } -
trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js
r112070 r112236 118 118 else 119 119 contentProvider = new WebInspector.CompilerSourceMappingContentProvider(sourceURL); 120 var uiSourceCode = new WebInspector.UISourceCode (sourceURL, sourceURL, contentProvider);120 var uiSourceCode = new WebInspector.UISourceCodeImpl(sourceURL, sourceURL, contentProvider); 121 121 uiSourceCode.isContentScript = script.isContentScript; 122 122 uiSourceCode.isEditable = false; -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r111595 r112236 221 221 _updateBreakpointsAfterLiveEdit: function(uiSourceCode, oldSource, newSource) 222 222 { 223 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);223 var breakpoints = uiSourceCode.breakpoints(); 224 224 225 225 // Clear and re-create breakpoints according to text diff. … … 352 352 breakpointsForUISourceCode: function(uiSourceCode) 353 353 { 354 var breakpointsMap = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);354 var breakpointsMap = uiSourceCode.breakpoints(); 355 355 var breakpointsList = []; 356 356 for (var lineNumber in breakpointsMap) … … 434 434 findBreakpoint: function(uiSourceCode, lineNumber) 435 435 { 436 return this._breakpointManager.breakpointsForUISourceCode(uiSourceCode)[String(lineNumber)];436 return uiSourceCode.breakpoints()[lineNumber]; 437 437 }, 438 438 … … 571 571 572 572 WebInspector.DebuggerPresentationModel.prototype.__proto__ = WebInspector.Object.prototype; 573 574 575 /** 576 * @constructor 577 * @extends {WebInspector.UISourceCode} 578 * @param {string} id 579 * @param {string} url 580 * @param {WebInspector.ContentProvider} contentProvider 581 */ 582 WebInspector.UISourceCodeImpl = function(id, url, contentProvider) 583 { 584 WebInspector.UISourceCode.call(this, id, url, contentProvider); 585 /** 586 * @type {Object.<string,WebInspector.UIBreakpoint>} 587 */ 588 this._breakpoints = {}; 589 } 590 591 WebInspector.UISourceCodeImpl.prototype = { 592 breakpoints: function() 593 { 594 return this._breakpoints; 595 }, 596 597 breakpointAdded: function(lineNumber, breakpoint) 598 { 599 this._breakpoints[lineNumber] = breakpoint; 600 }, 601 602 breakpointRemoved: function(lineNumber) 603 { 604 delete this._breakpoints[lineNumber]; 605 } 606 } 607 608 WebInspector.UISourceCodeImpl.prototype.__proto__ = WebInspector.UISourceCode.prototype; 573 609 574 610 /** -
trunk/Source/WebCore/inspector/front-end/RawSourceCode.js
r111670 r112236 213 213 _createUISourceCode: function(id, url, contentProvider) 214 214 { 215 var uiSourceCode = new WebInspector.UISourceCode (id, url, contentProvider);215 var uiSourceCode = new WebInspector.UISourceCodeImpl(id, url, contentProvider); 216 216 uiSourceCode.isContentScript = this.isContentScript; 217 217 uiSourceCode.isEditable = this._scripts.length === 1 && !this._scripts[0].lineOffset && !this._scripts[0].columnOffset && !this._formatted; -
trunk/Source/WebCore/inspector/front-end/SnippetsModel.js
r111694 r112236 376 376 var uiSourceCodeId = ""; // FIXME: to be implemented. 377 377 var uiSourceCodeURL = ""; // FIXME: to be implemented. 378 var uiSourceCode = new WebInspector.UISourceCode (uiSourceCodeId, uiSourceCodeURL, new WebInspector.SnippetContentProvider(snippet));378 var uiSourceCode = new WebInspector.UISourceCodeImpl(uiSourceCodeId, uiSourceCodeURL, new WebInspector.SnippetContentProvider(snippet)); 379 379 uiSourceCode.isSnippet = true; 380 380 uiSourceCode.isEditable = true; … … 399 399 _createUISourceCodeForScript: function(script) 400 400 { 401 var uiSourceCode = new WebInspector.UISourceCode (script.sourceURL, script.sourceURL, new WebInspector.ScriptContentProvider(script));401 var uiSourceCode = new WebInspector.UISourceCodeImpl(script.sourceURL, script.sourceURL, new WebInspector.ScriptContentProvider(script)); 402 402 uiSourceCode.isSnippetEvaluation = true; 403 403 var oldUISourceCode = this._uiSourceCodeForScriptId[script.scriptId]; -
trunk/Source/WebCore/inspector/front-end/UISourceCode.js
r109899 r112236 113 113 if (typeof(this._domain) === "undefined") 114 114 this._parseURL(); 115 115 116 116 return this._domain; 117 117 }, 118 118 119 119 /** 120 120 * @type {string} … … 124 124 if (typeof(this._folderName) === "undefined") 125 125 this._parseURL(); 126 126 127 127 return this._folderName; 128 128 }, 129 129 130 130 /** 131 131 * @type {string} … … 135 135 if (typeof(this._fileName) === "undefined") 136 136 this._parseURL(); 137 137 138 138 return this._fileName; 139 139 }, 140 140 141 141 /** 142 142 * @type {string} … … 146 146 if (typeof(this._displayName) === "undefined") 147 147 this._parseURL(); 148 148 149 149 return this._displayName; 150 150 }, 151 151 152 152 _parseURL: function() 153 153 { … … 173 173 var lastPathComponent = fileName.substring(0, indexOfQuery); 174 174 var queryParams = fileName.substring(indexOfQuery, fileName.length); 175 175 176 176 const maxDisplayNameLength = 30; 177 177 const minDisplayQueryParamLength = 5; 178 178 179 179 var maxDisplayQueryParamLength = Math.max(minDisplayQueryParamLength, maxDisplayNameLength - lastPathComponent.length); 180 180 var displayQueryParams = queryParams.trimEnd(maxDisplayQueryParamLength); … … 206 206 this._requestContentCallbacks[i](mimeType, content); 207 207 this._requestContentCallbacks = []; 208 } 208 }, 209 210 breakpoints: function() {} 209 211 } 210 212 -
trunk/Source/WebCore/inspector/front-end/inspector.html
r111655 r112236 170 170 <script type="text/javascript" src="DebuggerModel.js"></script> 171 171 <script type="text/javascript" src="ScriptMapping.js"></script> 172 <script type="text/javascript" src="UISourceCode.js"></script> 172 173 <script type="text/javascript" src="DebuggerPresentationModel.js"></script> 173 174 <script type="text/javascript" src="BreakpointManager.js"></script> 174 <script type="text/javascript" src="UISourceCode.js"></script>175 175 <script type="text/javascript" src="ContentProviders.js"></script> 176 176 <script type="text/javascript" src="RawSourceCode.js"></script>
Note: See TracChangeset
for help on using the changeset viewer.