Title: [130258] branches/chromium/1271/Source/WebCore/inspector/front-end
Revision
130258
Author
[email protected]
Date
2012-10-03 00:31:39 -0700 (Wed, 03 Oct 2012)

Log Message

Merge 129775 - Web Inspector: [REGRESSION] Breakpoints are not always shown in breakpoints sidebar pane.
https://bugs.webkit.org/show_bug.cgi?id=97783

Reviewed by Pavel Feldman.

BreakpointSidebarPane now explicitly adds all breakpoints that are available at the moment of its creation.

* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype._filteredBreakpointLocations):
(WebInspector.BreakpointManager.prototype.breakpointLocationsForUISourceCode):
(WebInspector.BreakpointManager.prototype.allBreakpointLocations):
* inspector/front-end/BreakpointsSidebarPane.js:
(WebInspector._javascript_BreakpointsSidebarPane):
(WebInspector._javascript_BreakpointsSidebarPane.prototype._breakpointAdded):


[email protected]
BUG=152684
Review URL: https://codereview.chromium.org/11048015

Modified Paths

Diff

Modified: branches/chromium/1271/Source/WebCore/inspector/front-end/BreakpointManager.js (130257 => 130258)


--- branches/chromium/1271/Source/WebCore/inspector/front-end/BreakpointManager.js	2012-10-03 06:57:00 UTC (rev 130257)
+++ branches/chromium/1271/Source/WebCore/inspector/front-end/BreakpointManager.js	2012-10-03 07:31:39 UTC (rev 130258)
@@ -133,17 +133,17 @@
     },
 
     /**
-     * @param {WebInspector.UISourceCode} uiSourceCode
-     * @return {Array.<Object>}
+     * @param {function(WebInspector.BreakpointManager.Breakpoint, WebInspector.UILocation)} filter
+     * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, uiLocation: WebInspector.UILocation}>}
      */
-    breakpointLocationsForUISourceCode: function(uiSourceCode)
+    _filteredBreakpointLocations: function(filter)
     {
         var result = [];
         for (var i = 0; i < this._breakpoints.length; ++i) {
             var breakpoint = this._breakpoints[i];
             for (var stringifiedLocation in breakpoint._uiLocations) {
                 var uiLocation = breakpoint._uiLocations[stringifiedLocation];
-                if (uiLocation.uiSourceCode === uiSourceCode)
+                if (filter(breakpoint, uiLocation))
                     result.push({breakpoint: breakpoint, uiLocation: uiLocation});
             }
         }
@@ -151,6 +151,28 @@
     },
 
     /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, uiLocation: WebInspector.UILocation}>}
+     */
+    breakpointLocationsForUISourceCode: function(uiSourceCode)
+    {
+        function filter(breakpoint, uiLocation)
+        {
+            return uiLocation.uiSourceCode === uiSourceCode;   
+        }
+        
+        return this._filteredBreakpointLocations(filter);
+    },
+
+    /**
+     * @return {Array.<{breakpoint: WebInspector.BreakpointManager.Breakpoint, uiLocation: WebInspector.UILocation}>}
+     */
+    allBreakpointLocations: function()
+    {
+        return this._filteredBreakpointLocations(function(breakpoint, uiLocation) { return true; });
+    },
+
+    /**
      * @param {boolean} toggleState
      */
     toggleAllBreakpoints: function(toggleState)

Modified: branches/chromium/1271/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js (130257 => 130258)


--- branches/chromium/1271/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js	2012-10-03 06:57:00 UTC (rev 130257)
+++ branches/chromium/1271/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js	2012-10-03 07:31:39 UTC (rev 130258)
@@ -45,6 +45,11 @@
     this.bodyElement.appendChild(this.emptyElement);
 
     this._items = new Map();
+    
+    var breakpointLocations = this._breakpointManager.allBreakpointLocations();
+    for (var i = 0; i < breakpointLocations.length; ++i)
+        this._addBreakpoint(breakpointLocations[i].breakpoint, breakpointLocations[i].uiLocation);
+
     this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this);
     this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this);
 }
@@ -59,7 +64,15 @@
 
         var breakpoint = /** @type {WebInspector.BreakpointManager.Breakpoint} */ event.data.breakpoint;
         var uiLocation = /** @type {WebInspector.UILocation} */ event.data.uiLocation;
+        this._addBreakpoint(breakpoint, uiLocation);
+    },
 
+    /**
+     * @param {WebInspector.BreakpointManager.Breakpoint} breakpoint
+     * @param {WebInspector.UILocation} uiLocation
+     */
+    _addBreakpoint: function(breakpoint, uiLocation)
+    {
         var element = document.createElement("li");
         element.addStyleClass("cursor-pointer");
         element.addEventListener("contextmenu", this._breakpointContextMenu.bind(this, breakpoint), true);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to