Changeset 60450 in webkit
- Timestamp:
- May 31, 2010 12:46:55 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r60449 r60450 1 2010-05-31 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: Moved breakpoints add/remove logic to the BreakpointManager. 6 7 https://bugs.webkit.org/show_bug.cgi?id=14190 8 9 * WebCore.gypi: 10 * WebCore.vcproj/WebCore.vcproj: 11 * inspector/front-end/Breakpoint.js: 12 * inspector/front-end/BreakpointManager.js: Added. 13 (WebInspector.BreakpointManager): 14 (WebInspector.BreakpointManager.prototype.addBreakpoint): 15 (WebInspector.BreakpointManager.prototype.removeBreakpoint): 16 (WebInspector.BreakpointManager.prototype.breakpointsForSourceID): 17 (WebInspector.BreakpointManager.prototype.breakpointsForURL): 18 (WebInspector.BreakpointManager.prototype.reset): 19 (WebInspector.BreakpointManager.prototype._saveBreakpointOnBackend): 20 (WebInspector.BreakpointManager.prototype._removeBreakpointFromBackend): 21 (WebInspector.Breakpoint): 22 (WebInspector.Breakpoint.prototype.get enabled): 23 (WebInspector.Breakpoint.prototype.set enabled): 24 (WebInspector.Breakpoint.prototype.get sourceText): 25 (WebInspector.Breakpoint.prototype.set sourceText): 26 (WebInspector.Breakpoint.prototype.get label): 27 (WebInspector.Breakpoint.prototype.get id): 28 (WebInspector.Breakpoint.prototype.get condition): 29 (WebInspector.Breakpoint.prototype.set condition): 30 * inspector/front-end/BreakpointsSidebarPane.js: 31 (WebInspector.BreakpointsSidebarPane): 32 (WebInspector.BreakpointsSidebarPane.prototype.reset): 33 (WebInspector.BreakpointsSidebarPane.prototype._breakpointAdded): 34 (WebInspector.BreakpointsSidebarPane.prototype._breakpointRemoved): 35 (WebInspector.BreakpointsSidebarPane.prototype._breakpointEnableChanged): 36 * inspector/front-end/Object.js: 37 (WebInspector.Object.prototype.dispatchEventToListeners): 38 * inspector/front-end/ScriptView.js: 39 (WebInspector.ScriptView.prototype._addBreakpoint): 40 * inspector/front-end/ScriptsPanel.js: 41 (WebInspector.ScriptsPanel): 42 (WebInspector.ScriptsPanel.prototype._breakpointAdded): 43 (WebInspector.ScriptsPanel.prototype._breakpointRemoved): 44 (WebInspector.ScriptsPanel.prototype.editScriptSource.mycallback): 45 (WebInspector.ScriptsPanel.prototype.editScriptSource): 46 (WebInspector.ScriptsPanel.prototype._showScriptOrResource): 47 * inspector/front-end/SourceFrame.js: 48 (WebInspector.SourceFrame.prototype._contextMenu): 49 * inspector/front-end/SourceView.js: 50 (WebInspector.SourceView.prototype._addBreakpoint): 51 (WebInspector.SourceView.prototype._removeBreakpoint): 52 * inspector/front-end/WebKit.qrc: 53 * inspector/front-end/inspector.html: 54 * inspector/front-end/inspector.js: 55 (WebInspector.loaded): 56 (WebInspector.restoredBreakpoint): 57 (WebInspector.reset): 58 1 59 2010-05-31 Alexander Pavlov <apavlov@chromium.org> 2 60 -
trunk/WebCore/WebCore.gypi
r60449 r60450 3872 3872 'inspector/front-end/AuditsPanel.js', 3873 3873 'inspector/front-end/BottomUpProfileDataGridTree.js', 3874 'inspector/front-end/Breakpoint .js',3874 'inspector/front-end/BreakpointManager.js', 3875 3875 'inspector/front-end/BreakpointsSidebarPane.js', 3876 3876 'inspector/front-end/Callback.js', -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r60449 r60450 44769 44769 </File> 44770 44770 <File 44771 RelativePath="..\inspector\front-end\Breakpoint .js"44771 RelativePath="..\inspector\front-end\BreakpointManager.js" 44772 44772 > 44773 44773 </File> -
trunk/WebCore/inspector/front-end/Breakpoint.js
r55071 r60450 1 /*2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.3 *4 * Redistribution and use in source and binary forms, with or without5 * modification, are permitted provided that the following conditions6 * are met:7 * 1. Redistributions of source code must retain the above copyright8 * notice, this list of conditions and the following disclaimer.9 * 2. Redistributions in binary form must reproduce the above copyright10 * notice, this list of conditions and the following disclaimer in the11 * documentation and/or other materials provided with the distribution.12 *13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.24 */25 26 WebInspector.Breakpoint = function(url, line, sourceID, condition)27 {28 this.url = url;29 this.line = line;30 this.sourceID = sourceID;31 this._enabled = true;32 this._sourceText = "";33 this._condition = condition || "";34 }35 36 WebInspector.Breakpoint.prototype = {37 get enabled()38 {39 return this._enabled;40 },41 42 set enabled(x)43 {44 if (this._enabled === x)45 return;46 47 this._enabled = x;48 49 if (this._enabled)50 this.dispatchEventToListeners("enabled");51 else52 this.dispatchEventToListeners("disabled");53 },54 55 get sourceText()56 {57 return this._sourceText;58 },59 60 set sourceText(text)61 {62 this._sourceText = text;63 this.dispatchEventToListeners("text-changed");64 },65 66 get label()67 {68 var displayName = (this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"));69 return displayName + ":" + this.line;70 },71 72 get id()73 {74 return this.sourceID + ":" + this.line;75 },76 77 get condition()78 {79 return this._condition;80 },81 82 set condition(c)83 {84 c = c || "";85 if (this._condition === c)86 return;87 88 this._condition = c;89 this.dispatchEventToListeners("condition-changed");90 91 if (this.enabled)92 InspectorBackend.setBreakpoint(this.sourceID, this.line, this.enabled, this.condition);93 }94 }95 96 WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/WebCore/inspector/front-end/BreakpointsSidebarPane.js
r56395 r60450 28 28 WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); 29 29 30 this.breakpoints = {};31 32 30 this.listElement = document.createElement("ol"); 33 31 this.listElement.className = "breakpoint-list"; … … 38 36 39 37 this.bodyElement.appendChild(this.emptyElement); 38 39 WebInspector.breakpointManager.addEventListener("breakpoint-added", this._breakpointAdded, this); 40 WebInspector.breakpointManager.addEventListener("breakpoint-removed", this._breakpointRemoved, this); 40 41 } 41 42 … … 43 44 reset: function() 44 45 { 45 this.breakpoints = {};46 46 this.listElement.removeChildren(); 47 47 if (this.listElement.parentElement) { … … 51 51 }, 52 52 53 addBreakpoint: function(breakpoint)53 _breakpointAdded: function(event) 54 54 { 55 if (this.breakpoints[breakpoint.id]) 56 return; 57 58 this.breakpoints[breakpoint.id] = breakpoint; 55 var breakpoint = event.data; 59 56 60 57 breakpoint.addEventListener("enabled", this._breakpointEnableChanged, this); … … 68 65 this.bodyElement.appendChild(this.listElement); 69 66 } 70 71 InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);72 67 }, 73 68 … … 122 117 }, 123 118 124 removeBreakpoint: function(breakpoint)119 _breakpointRemoved: function(event) 125 120 { 126 if (!this.breakpoints[breakpoint.id]) 127 return; 128 delete this.breakpoints[breakpoint.id]; 121 var breakpoint = event.data; 129 122 130 123 breakpoint.removeEventListener("enabled", null, this); … … 139 132 this.bodyElement.appendChild(this.emptyElement); 140 133 } 141 142 InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line);143 134 }, 144 135 … … 149 140 var checkbox = breakpoint._breakpointListElement.firstChild; 150 141 checkbox.checked = breakpoint.enabled; 151 InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);152 142 }, 153 143 -
trunk/WebCore/inspector/front-end/Object.js
r48970 r60450 51 51 }, 52 52 53 dispatchEventToListeners: function(eventType ) {53 dispatchEventToListeners: function(eventType, eventData) { 54 54 if (!("_listeners" in this) || !(eventType in this._listeners)) 55 55 return; … … 67 67 } 68 68 69 var event = {target: this, type: eventType, d efaultPrevented: false};69 var event = {target: this, type: eventType, data: eventData, defaultPrevented: false}; 70 70 event.stopPropagation = stopPropagation; 71 71 event.preventDefault = preventDefault; -
trunk/WebCore/inspector/front-end/ScriptView.js
r58477 r60450 74 74 _addBreakpoint: function(line) 75 75 { 76 var breakpoint = new WebInspector.Breakpoint(this.script.sourceURL, line, this.script.sourceID); 77 WebInspector.panels.scripts.addBreakpoint(breakpoint); 76 WebInspector.breakpointManager.addBreakpoint(this.script.sourceID, this.script.sourceURL, line, true, ""); 78 77 }, 79 78 -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r60265 r60450 172 172 if (Preferences.debuggerAlwaysEnabled) 173 173 this._attachDebuggerWhenShown = true; 174 175 WebInspector.breakpointManager.addEventListener("breakpoint-added", this._breakpointAdded, this); 176 WebInspector.breakpointManager.addEventListener("breakpoint-removed", this._breakpointRemoved, this); 177 174 178 this.reset(); 175 179 } … … 286 290 }, 287 291 288 addBreakpoint: function(breakpoint) 289 { 292 _breakpointAdded: function(event) 293 { 294 var breakpoint = event.data; 295 290 296 if (!this.breakpointsActivated) 291 297 this._toggleBreakpointsClicked(); 292 293 this.sidebarPanes.breakpoints.addBreakpoint(breakpoint);294 298 295 299 var sourceFrame; … … 309 313 }, 310 314 311 removeBreakpoint: function(breakpoint)312 { 313 this.sidebarPanes.breakpoints.removeBreakpoint(breakpoint);315 _breakpointRemoved: function(event) 316 { 317 var breakpoint = event.data; 314 318 315 319 var sourceFrame; … … 340 344 341 345 // Need to clear breakpoints and re-create them later when editing source. 342 var breakpointsPanel = this.sidebarPanes.breakpoints; 343 var newBreakpoints = []; 344 for (var id in breakpointsPanel.breakpoints) { 345 var breakpoint = breakpointsPanel.breakpoints[id]; 346 breakpointsPanel.removeBreakpoint(breakpoint); 347 newBreakpoints.push(breakpoint); 348 } 346 var breakpoints = WebInspector.breakpointManager.breakpointsForSourceID(sourceID); 347 for (var i = 0; i < breakpoints.length; ++i) 348 WebInspector.breakpointManager.removeBreakpoint(breakpoints[i]); 349 349 350 350 function mycallback(newBody) 351 351 { 352 352 callback(newBody); 353 for (var i = 0; i < newBreakpoints.length; ++i) {354 var breakpoint = newBreakpoints[i];353 for (var i = 0; i < breakpoints.length; ++i) { 354 var breakpoint = breakpoints[i]; 355 355 if (breakpoint.line >= line) 356 356 breakpoint.line += linesCountToShift; 357 this.addBreakpoint(breakpoint);357 WebInspector.breakpointManager.addBreakpoint(breakpoint); 358 358 } 359 359 }; … … 613 613 view = WebInspector.panels.resources.resourceViewForResource(scriptOrResource); 614 614 view.headersVisible = false; 615 var breakpoints = this.sidebarPanes.breakpoints.breakpoints; 616 for (var breakpointId in breakpoints) { 617 var breakpoint = breakpoints[breakpointId]; 618 if (breakpoint.url === scriptOrResource.url) { 619 var sourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource); 620 sourceFrame.addBreakpoint(breakpoint); 621 } 622 } 615 var sourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource); 616 var breakpoints = WebInspector.breakpointManager.breakpointsForURL(scriptOrResource.url); 617 for (var i = 0; i < breakpoints.length; ++i) 618 sourceFrame.addBreakpoint(breakpoints[i]); 623 619 } else if (scriptOrResource instanceof WebInspector.Script) 624 620 view = this.scriptViewForScript(scriptOrResource); -
trunk/WebCore/inspector/front-end/SourceFrame.js
r59688 r60450 429 429 } else { 430 430 // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable. 431 contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), WebInspector.panels.scripts.removeBreakpoint.bind(WebInspector.panels.scripts, breakpoint));431 contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._removeBreakpointDelegate.bind(this, breakpoint)); 432 432 contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), this._editBreakpointCondition.bind(this, breakpoint)); 433 433 if (breakpoint.enabled) -
trunk/WebCore/inspector/front-end/SourceView.js
r60445 r60450 119 119 { 120 120 var sourceID = this._sourceIDForLine(line); 121 if (WebInspector.panels.scripts) { 122 var breakpoint = new WebInspector.Breakpoint(this.resource.url, line, sourceID); 123 WebInspector.panels.scripts.addBreakpoint(breakpoint); 124 } 121 WebInspector.breakpointManager.addBreakpoint(sourceID, this.resource.url, line, true, ""); 125 122 }, 126 123 127 124 _removeBreakpoint: function(breakpoint) 128 125 { 129 if (WebInspector.panels.scripts) 130 WebInspector.panels.scripts.removeBreakpoint(breakpoint); 126 WebInspector.breakpointManager.removeBreakpoint(breakpoint); 131 127 }, 132 128 -
trunk/WebCore/inspector/front-end/WebKit.qrc
r60449 r60450 9 9 <file>AuditsPanel.js</file> 10 10 <file>BottomUpProfileDataGridTree.js</file> 11 <file>Breakpoint .js</file>11 <file>BreakpointManager.js</file> 12 12 <file>BreakpointsSidebarPane.js</file> 13 13 <file>Callback.js</file> -
trunk/WebCore/inspector/front-end/inspector.html
r60445 r60450 65 65 <script type="text/javascript" src="CookieItemsView.js"></script> 66 66 <script type="text/javascript" src="Script.js"></script> 67 <script type="text/javascript" src="Breakpoint .js"></script>67 <script type="text/javascript" src="BreakpointManager.js"></script> 68 68 <script type="text/javascript" src="SidebarPane.js"></script> 69 69 <script type="text/javascript" src="ElementsTreeOutline.js"></script> -
trunk/WebCore/inspector/front-end/inspector.js
r60206 r60450 466 466 }; 467 467 468 this.breakpointManager = new WebInspector.BreakpointManager(); 469 468 470 this.panels = {}; 469 471 this._createPanels(); … … 1324 1326 WebInspector.restoredBreakpoint = function(sourceID, sourceURL, line, enabled, condition) 1325 1327 { 1326 var breakpoint = new WebInspector.Breakpoint(sourceURL, line, sourceID, condition); 1327 breakpoint.enabled = enabled; 1328 this.panels.scripts.addBreakpoint(breakpoint); 1328 this.breakpointManager.addBreakpoint(sourceID, sourceURL, line, enabled, condition); 1329 1329 } 1330 1330 … … 1360 1360 panel.reset(); 1361 1361 } 1362 1363 this.breakpointManager.reset(); 1362 1364 1363 1365 for (var category in this.resourceCategories)
Note: See TracChangeset
for help on using the changeset viewer.