Title: [216546] trunk/Source/WebInspectorUI
Revision
216546
Author
bb...@apple.com
Date
2017-05-09 15:18:53 -0700 (Tue, 09 May 2017)

Log Message

Web Inspector: Assertion failed: Cannot select item with unexpected parent bar. (at NavigationBar.js:132)
https://bugs.webkit.org/show_bug.cgi?id=171885

Reviewed by Matt Baker.

This new assertion revealed a real misuse of the NavigationBar API.

* UserInterface/Views/NavigationBar.js:
(WebInspector.NavigationBar.prototype.set selectedNavigationItem):
Improve this to be an assertion so it can be paused at using the debugger.

* UserInterface/Views/TimelineTabContentView.js:
(WebInspector.TimelineTabContentView.prototype._changeViewMode):
We need to set a NavigationItem as the selected item, not its identifier.
Look up the corresponding item for the identifier that we received (the view mode).

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (216545 => 216546)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-05-09 22:06:13 UTC (rev 216545)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-05-09 22:18:53 UTC (rev 216546)
@@ -1,3 +1,21 @@
+2017-05-09  Brian Burg  <bb...@apple.com>
+
+        Web Inspector: Assertion failed: Cannot select item with unexpected parent bar. (at NavigationBar.js:132)
+        https://bugs.webkit.org/show_bug.cgi?id=171885
+
+        Reviewed by Matt Baker.
+
+        This new assertion revealed a real misuse of the NavigationBar API.
+
+        * UserInterface/Views/NavigationBar.js:
+        (WebInspector.NavigationBar.prototype.set selectedNavigationItem):
+        Improve this to be an assertion so it can be paused at using the debugger.
+
+        * UserInterface/Views/TimelineTabContentView.js:
+        (WebInspector.TimelineTabContentView.prototype._changeViewMode):
+        We need to set a NavigationItem as the selected item, not its identifier.
+        Look up the corresponding item for the identifier that we received (the view mode).
+
 2017-05-08  Brian Burg  <bb...@apple.com>
 
         Web Inspector: RTL: box model labels have bad alignment

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js (216545 => 216546)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js	2017-05-09 22:06:13 UTC (rev 216545)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationBar.js	2017-05-09 22:18:53 UTC (rev 216546)
@@ -128,10 +128,10 @@
 
     set selectedNavigationItem(navigationItem)
     {
-        if (navigationItem && navigationItem.parentNavigationBar !== this) {
-            console.error("Cannot select item with unexpected parent bar.", navigationItem);
+        let navigationItemHasOtherParent = navigationItem && navigationItem.parentNavigationBar !== this;
+        console.assert(!navigationItemHasOtherParent, "Cannot select item with unexpected parent bar.", navigationItem);
+        if (navigationItemHasOtherParent)
             return;
-        }
 
         // Only radio navigation items can be selected.
         if (!(navigationItem instanceof WebInspector.RadioButtonNavigationItem))

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js (216545 => 216546)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js	2017-05-09 22:06:13 UTC (rev 216545)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js	2017-05-09 22:18:53 UTC (rev 216546)
@@ -513,9 +513,15 @@
         if (this._viewMode === mode)
             return;
 
+        let navigationItemForViewMode = this.contentBrowser.navigationBar.findNavigationItem(mode);
+        console.assert(navigationItemForViewMode, "Couldn't find navigation item for this view mode.");
+        if (!navigationItemForViewMode)
+            return;
+
         this._viewMode = mode;
-        this.contentBrowser.navigationBar.selectedNavigationItem = this._viewMode;
 
+        this.contentBrowser.navigationBar.selectedNavigationItem = navigationItemForViewMode;
+
         if (!selectedByUser)
             return;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to