Title: [111385] trunk
Revision
111385
Author
[email protected]
Date
2012-03-20 05:22:22 -0700 (Tue, 20 Mar 2012)

Log Message

Web Inspector: call .length as the last check when detecting arrays.
https://bugs.webkit.org/show_bug.cgi?id=81335

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/InjectedScriptSource.js:

LayoutTests:

* inspector/console/console-format-collections-expected.txt:
* inspector/console/console-format-collections.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111384 => 111385)


--- trunk/LayoutTests/ChangeLog	2012-03-20 12:17:26 UTC (rev 111384)
+++ trunk/LayoutTests/ChangeLog	2012-03-20 12:22:22 UTC (rev 111385)
@@ -1,3 +1,13 @@
+2012-03-20  Pavel Feldman  <[email protected]>
+
+        Web Inspector: call .length as the last check when detecting arrays.
+        https://bugs.webkit.org/show_bug.cgi?id=81335
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/console/console-format-collections-expected.txt:
+        * inspector/console/console-format-collections.html:
+
 2012-03-20  Alexander Pavlov  <[email protected]>
 
         Web Inspector: newly added CSS rules shouldn't rewrite HTML content in the resources panel

Modified: trunk/LayoutTests/inspector/console/console-format-collections-expected.txt (111384 => 111385)


--- trunk/LayoutTests/inspector/console/console-format-collections-expected.txt	2012-03-20 12:17:26 UTC (rev 111384)
+++ trunk/LayoutTests/inspector/console/console-format-collections-expected.txt	2012-03-20 12:22:22 UTC (rev 111385)
@@ -5,6 +5,7 @@
 CONSOLE MESSAGE: line 31: [object HTMLCollection]
 CONSOLE MESSAGE: line 35: [object NodeList]
 CONSOLE MESSAGE: line 41: 1,2,
+CONSOLE MESSAGE: line 44: [object Object]
 Tests that console nicely formats HTML Collections and NodeLists.
 
 [<select id="sel" name="sel">…</select>] console-format-collections.html:15
@@ -16,4 +17,5 @@
 [<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:31
 [<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:35
 [1, Array[2]] console-format-collections.html:41
+NonArrayWithLength console-format-collections.html:44
 

Modified: trunk/LayoutTests/inspector/console/console-format-collections.html (111384 => 111385)


--- trunk/LayoutTests/inspector/console/console-format-collections.html	2012-03-20 12:17:26 UTC (rev 111384)
+++ trunk/LayoutTests/inspector/console/console-format-collections.html	2012-03-20 12:22:22 UTC (rev 111385)
@@ -40,9 +40,23 @@
     arrayX.push(arrayY);
     console.log(arrayX);
 
+    var nonArray = new NonArrayWithLength();
+    console.log(nonArray);
+
     runTest();
 }
 
+function NonArrayWithLength()
+{
+    this.keys=[];
+}
+
+NonArrayWithLength.prototype.__defineGetter__("length", function()
+{
+    console.log(".length should not be called");
+    return this.keys.length;
+});
+
 function test()
 {
     InspectorTest.dumpConsoleMessages();

Modified: trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt (111384 => 111385)


--- trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt	2012-03-20 12:17:26 UTC (rev 111384)
+++ trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt	2012-03-20 12:22:22 UTC (rev 111385)
@@ -5,6 +5,7 @@
 CONSOLE MESSAGE: line 31: [object HTMLCollection]
 CONSOLE MESSAGE: line 35: [object NodeList]
 CONSOLE MESSAGE: line 41: 1,2,
+CONSOLE MESSAGE: line 44: [object Object]
 Tests that console nicely formats HTML Collections and NodeLists.
 
 [<select id="sel" name="sel">…</select>] console-format-collections.html:15
@@ -16,4 +17,5 @@
 [<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:31
 [<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:35
 [1, Array[2]] console-format-collections.html:41
+NonArrayWithLength console-format-collections.html:44
 

Modified: trunk/Source/WebCore/ChangeLog (111384 => 111385)


--- trunk/Source/WebCore/ChangeLog	2012-03-20 12:17:26 UTC (rev 111384)
+++ trunk/Source/WebCore/ChangeLog	2012-03-20 12:22:22 UTC (rev 111385)
@@ -1,3 +1,12 @@
+2012-03-20  Pavel Feldman  <[email protected]>
+
+        Web Inspector: call .length as the last check when detecting arrays.
+        https://bugs.webkit.org/show_bug.cgi?id=81335
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/InjectedScriptSource.js:
+
 2012-03-20  Alexander Pavlov  <[email protected]>
 
         Web Inspector: newly added CSS rules shouldn't rewrite HTML content in the resources panel

Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (111384 => 111385)


--- trunk/Source/WebCore/inspector/InjectedScriptSource.js	2012-03-20 12:17:26 UTC (rev 111384)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js	2012-03-20 12:22:22 UTC (rev 111385)
@@ -422,9 +422,9 @@
 
         // FireBug's array detection.
         try {
-            if (isFinite(obj.length) && typeof obj.splice === "function")
+            if (typeof obj.splice === "function" && isFinite(obj.length))
                 return "array";
-            if (isFinite(obj.length) && typeof obj.callee === "function") // arguments.
+            if (typeof obj.callee === "function" && isFinite(obj.length)) // arguments.
                 return "array";
         } catch (e) {
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to