Uncaught Exception: TypeError: null is not an object (evaluating 'event.data.pathComp...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 May 2016 04:11:41 +0000 (04:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 May 2016 04:11:41 +0000 (04:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157759
<rdar://problem/26309427>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-05-16
Reviewed by Timothy Hatcher.

* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype._pathComponentSelected):
Handle possible null path components.

* UserInterface/Views/HierarchicalPathComponent.js:
(WebInspector.HierarchicalPathComponent.prototype.get selectedPathComponent):
When there is a list of just one that is triggered, the Clicked
event should produce that one, to be consistent with clicking
on a list of multiple elements and selecting the same value.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js

index cf097da..69a89ca 100644 (file)
@@ -1,3 +1,21 @@
+2016-05-16  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Uncaught Exception: TypeError: null is not an object (evaluating 'event.data.pathComponent.domTreeElement')
+        https://bugs.webkit.org/show_bug.cgi?id=157759
+        <rdar://problem/26309427>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WebInspector.DOMTreeContentView.prototype._pathComponentSelected):
+        Handle possible null path components.
+
+        * UserInterface/Views/HierarchicalPathComponent.js:
+        (WebInspector.HierarchicalPathComponent.prototype.get selectedPathComponent):
+        When there is a list of just one that is triggered, the Clicked
+        event should produce that one, to be consistent with clicking
+        on a list of multiple elements and selecting the same value.
+
 2016-05-16  Saam barati  <sbarati@apple.com>
 
         Hook up ShadowChicken to the debugger to show tail deleted frames
index add37b2..3ff3eba 100644 (file)
@@ -371,6 +371,9 @@ WebInspector.DOMTreeContentView = class DOMTreeContentView extends WebInspector.
 
     _pathComponentSelected(event)
     {
+        if (!event.data.pathComponent)
+            return;
+
         console.assert(event.data.pathComponent instanceof WebInspector.DOMTreeElementPathComponent);
         console.assert(event.data.pathComponent.domTreeElement instanceof WebInspector.DOMTreeElement);
 
index 1764271..3515313 100644 (file)
@@ -86,8 +86,10 @@ WebInspector.HierarchicalPathComponent = class HierarchicalPathComponent extends
 
     get selectedPathComponent()
     {
-        var selectElement = this._selectElement[this._selectElement.selectedIndex];
-        return selectElement && selectElement._pathComponent || null;
+        let selectedOption = this._selectElement[this._selectElement.selectedIndex];
+        if (!selectedOption && this._selectElement.options.length === 1)
+            selectedOption = this._selectElement.options[0];
+        return selectedOption && selectedOption._pathComponent || null;
     }
 
     get element()