REGRESSION: Web Inspector: Exception showing the DOM tree for a node with too many...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jun 2014 00:46:21 +0000 (00:46 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jun 2014 00:46:21 +0000 (00:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=129696

Fix issue where sometimes inspecting an element will try to attach the "show all nodes" button
before the expand function is called in TreeElement before _childrenListNode has been set.

Patch by Jono Wells <jonowells@apple.com> on 2014-06-09
Reviewed by Joseph Pecoraro.

* UserInterface/Views/TreeOutline.js:
(TreeOutline.prototype.appendChild):
(TreeOutline.prototype.insertChild):
Added check for existance of this._childrenListNode.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/TreeOutline.js

index 6b9760d506df57ede9d84d49460643a8e4beae8a..8744c620ea7925f8fff16d7a6b6f1f158dafc495 100644 (file)
@@ -1,3 +1,18 @@
+2014-06-09  Jono Wells  <jonowells@apple.com>
+
+        REGRESSION: Web Inspector: Exception showing the DOM tree for a node with too many children
+        https://bugs.webkit.org/show_bug.cgi?id=129696
+
+        Fix issue where sometimes inspecting an element will try to attach the "show all nodes" button
+        before the expand function is called in TreeElement before _childrenListNode has been set.
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/TreeOutline.js:
+        (TreeOutline.prototype.appendChild):
+        (TreeOutline.prototype.insertChild):
+        Added check for existance of this._childrenListNode.
+
 2014-05-29  Timothy Hatcher  <timothy@apple.com>
 
         Fix an exception in InspectorBackend.Command.prototype.supports.
index fff1db7c0ef20c1f116cb0a35a05d3b3074a4c38..e71a6325a8d5e30c40b0546eed42101d32facbd0 100644 (file)
@@ -85,8 +85,15 @@ TreeOutline.prototype.appendChild = function(child)
     if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
         child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (this._childrenListNode)
-        child._attach();
+    if (!this._childrenListNode) {
+        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
+        this._childrenListNode.parentTreeElement = this;
+        this._childrenListNode.classList.add("children");
+        if (this.hidden)
+            this._childrenListNode.classList.add("hidden");
+    }
+
+    child._attach();
 
     if (this.treeOutline.onadd)
         this.treeOutline.onadd(child);
@@ -134,8 +141,15 @@ TreeOutline.prototype.insertChild = function(child, index)
     if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
         child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (this._childrenListNode)
-        child._attach();
+    if (!this._childrenListNode) {
+        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
+        this._childrenListNode.parentTreeElement = this;
+        this._childrenListNode.classList.add("children");
+        if (this.hidden)
+            this._childrenListNode.classList.add("hidden");
+    }
+
+    child._attach();
 
     if (this.treeOutline.onadd)
         this.treeOutline.onadd(child);