Web Inspector: XHR breakpoints restored from settings do not appear in the sidebar
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Apr 2017 19:30:55 +0000 (19:30 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Apr 2017 19:30:55 +0000 (19:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170890

Reviewed by Joseph Pecoraro.

Need to check for existing breakpoints when XHRBreakpointTreeController
is constructed, instead of just listening for added breakpoints.

* UserInterface/Controllers/XHRBreakpointTreeController.js:
(WebInspector.XHRBreakpointTreeController):
(WebInspector.XHRBreakpointTreeController.prototype._xhrBreakpointAdded):
(WebInspector.XHRBreakpointTreeController.prototype._addTreeElement):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215422 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/XHRBreakpointTreeController.js

index cd3ba08..d7b7749 100644 (file)
@@ -1,3 +1,18 @@
+2017-04-17  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: XHR breakpoints restored from settings do not appear in the sidebar
+        https://bugs.webkit.org/show_bug.cgi?id=170890
+
+        Reviewed by Joseph Pecoraro.
+
+        Need to check for existing breakpoints when XHRBreakpointTreeController
+        is constructed, instead of just listening for added breakpoints.
+
+        * UserInterface/Controllers/XHRBreakpointTreeController.js:
+        (WebInspector.XHRBreakpointTreeController):
+        (WebInspector.XHRBreakpointTreeController.prototype._xhrBreakpointAdded):
+        (WebInspector.XHRBreakpointTreeController.prototype._addTreeElement):
+
 2017-04-14  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: WebSockets: messages with non-latin letters are displayed incorrectly
index ae498b6..2d10e29 100644 (file)
@@ -39,6 +39,9 @@ WebInspector.XHRBreakpointTreeController = class XHRBreakpointsTreeController ex
         this._allReqestsBreakpointTreeElement = new WebInspector.XHRBreakpointTreeElement(WebInspector.domDebuggerManager.allRequestsBreakpoint, WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName, WebInspector.UIString("All Requests"));
 
         this._treeOutline.appendChild(this._allReqestsBreakpointTreeElement);
+
+        for (let breakpoint of WebInspector.domDebuggerManager.xhrBreakpoints)
+            this._addTreeElement(breakpoint);
     }
 
     // Public
@@ -62,13 +65,7 @@ WebInspector.XHRBreakpointTreeController = class XHRBreakpointsTreeController ex
 
     _xhrBreakpointAdded(event)
     {
-        let breakpoint = event.data.breakpoint;
-        let treeElement = this._treeOutline.findTreeElement(breakpoint);
-        console.assert(!treeElement);
-        if (treeElement)
-            return;
-
-        this._treeOutline.appendChild(new WebInspector.XHRBreakpointTreeElement(breakpoint));
+        this._addTreeElement(event.data.breakpoint);
     }
 
     _xhrBreakpointRemoved(event)
@@ -89,4 +86,14 @@ WebInspector.XHRBreakpointTreeController = class XHRBreakpointsTreeController ex
         while (this._treeOutline.children.length > 1)
             this._treeOutline.removeChild(this._treeOutline.children.lastValue);
     }
+
+    _addTreeElement(breakpoint)
+    {
+        let treeElement = this._treeOutline.findTreeElement(breakpoint);
+        console.assert(!treeElement);
+        if (treeElement)
+            return;
+
+        this._treeOutline.appendChild(new WebInspector.XHRBreakpointTreeElement(breakpoint));
+    }
 };