Title: [239246] trunk/Source/WebInspectorUI
Revision
239246
Author
mattba...@apple.com
Date
2018-12-14 19:34:54 -0800 (Fri, 14 Dec 2018)

Log Message

Web Inspector: REGRESSION(r238599): Uncaught Exception: TypeError: null is not an object (evaluating 'treeElement.listItemElement.classList')
https://bugs.webkit.org/show_bug.cgi?id=192090
<rdar://problem/46318614>

Reviewed by Devin Rousso.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.selectionControllerSelectionDidChange):
Check that `listItemElement` is valid before accessing it to update class
names. The selection can change before the TreeElement has been attached.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (239245 => 239246)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-12-15 03:05:59 UTC (rev 239245)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-12-15 03:34:54 UTC (rev 239246)
@@ -1,5 +1,18 @@
 2018-12-14  Matt Baker  <mattba...@apple.com>
 
+        Web Inspector: REGRESSION(r238599): Uncaught Exception: TypeError: null is not an object (evaluating 'treeElement.listItemElement.classList')
+        https://bugs.webkit.org/show_bug.cgi?id=192090
+        <rdar://problem/46318614>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Views/TreeOutline.js:
+        (WI.TreeOutline.prototype.selectionControllerSelectionDidChange):
+        Check that `listItemElement` is valid before accessing it to update class
+        names. The selection can change before the TreeElement has been attached.
+
+2018-12-14  Matt Baker  <mattba...@apple.com>
+
         Web Inspector: Cookies view should use model objects instead of raw payload data
         https://bugs.webkit.org/show_bug.cgi?id=189533
         <rdar://problem/44364183>

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js (239245 => 239246)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2018-12-15 03:05:59 UTC (rev 239245)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2018-12-15 03:34:54 UTC (rev 239246)
@@ -803,7 +803,8 @@
             let treeElement = this._treeElementAtIndex(index);
             console.assert(treeElement, "Missing TreeElement for deselected index " + index);
             if (treeElement) {
-                treeElement.listItemElement.classList.remove("selected");
+                if (treeElement.listItemElement)
+                    treeElement.listItemElement.classList.remove("selected");
                 if (!this._suppressNextSelectionDidChangeEvent)
                     treeElement.deselect();
             }
@@ -813,7 +814,8 @@
             let treeElement = this._treeElementAtIndex(index);
             console.assert(treeElement, "Missing TreeElement for selected index " + index);
             if (treeElement) {
-                treeElement.listItemElement.classList.add("selected");
+                if (treeElement.listItemElement)
+                    treeElement.listItemElement.classList.add("selected");
                 if (!this._suppressNextSelectionDidChangeEvent)
                     treeElement.select();
             }
@@ -821,12 +823,12 @@
 
         let selectedTreeElement = this.selectedTreeElement;
         if (selectedTreeElement !== this._previousSelectedTreeElement) {
-            if (this._previousSelectedTreeElement)
+            if (this._previousSelectedTreeElement && this._previousSelectedTreeElement.listItemElement)
                 this._previousSelectedTreeElement.listItemElement.classList.remove("last-selected");
 
             this._previousSelectedTreeElement = selectedTreeElement;
 
-            if (this._previousSelectedTreeElement)
+            if (this._previousSelectedTreeElement && this._previousSelectedTreeElement.listItemElement)
                 this._previousSelectedTreeElement.listItemElement.classList.add("last-selected");
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to