Inspector should display Array lengths in the property lists.
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2010 02:25:47 +0000 (02:25 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2010 02:25:47 +0000 (02:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=20695

Reviewed by Timothy Hatcher.

* inspector/front-end/InjectedScript.js:
(injectedScriptConstructor):
For objects of type 'array' (which includes Arrays, NodeLists, and HTMLCollections), make the length of the object available via propertyLength on the proxy object.
* inspector/front-end/ObjectPropertiesSection.js:
(WebInspector.ObjectPropertyTreeElement.prototype.update):
For properties that have propertyLength defined, append it to the displayed description.

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

WebCore/ChangeLog
WebCore/inspector/front-end/InjectedScript.js
WebCore/inspector/front-end/ObjectPropertiesSection.js

index 3a6411d..54823a9 100644 (file)
@@ -1,3 +1,17 @@
+2010-02-16  Jessie Berlin  <jberlin@webkit.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Inspector should display Array lengths in the property lists.
+        https://bugs.webkit.org/show_bug.cgi?id=20695
+
+        * inspector/front-end/InjectedScript.js:
+        (injectedScriptConstructor):
+        For objects of type 'array' (which includes Arrays, NodeLists, and HTMLCollections), make the length of the object available via propertyLength on the proxy object.
+        * inspector/front-end/ObjectPropertiesSection.js:
+        (WebInspector.ObjectPropertyTreeElement.prototype.update):
+        For properties that have propertyLength defined, append it to the displayed description.
+
 2010-02-16  Yusuke Sato  <yusukes@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 20e440a..f248b91 100644 (file)
@@ -1150,6 +1150,8 @@ InjectedScript.createProxyObject = function(object, objectId, abbreviate)
     result.injectedScriptId = injectedScriptId;
     result.objectId = objectId;
     result.type = InjectedScript._type(object);
+    if (result.type === "array")
+        result.propertyLength = object.length;
 
     var type = typeof object;
     if ((type === "object" && object !== null) || type === "function") {
index f06a14d..a32e799 100644 (file)
@@ -178,6 +178,8 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
         this.valueElement = document.createElement("span");
         this.valueElement.className = "value";
         this.valueElement.textContent = this.property.value.description;
+        if (typeof this.property.value.propertyLength !== "undefined")
+            this.valueElement.textContent += " (" + this.property.value.propertyLength + ")";
         if (this.property.isGetter)
             this.valueElement.addStyleClass("dimmed");
         if (this.property.isError)