Title: [108511] trunk
Revision
108511
Author
pfeld...@chromium.org
Date
2012-02-22 09:39:03 -0800 (Wed, 22 Feb 2012)

Log Message

Web Inspector: console doesn't show properly arrays from which tail values have been deleted
https://bugs.webkit.org/show_bug.cgi?id=79242

Reviewed by Yury Semikhatsky.

Source/WebCore:

* English.lproj/localizedStrings.js:
* inspector/front-end/ConsoleMessage.js:
(WebInspector.ConsoleMessageImpl.prototype._printArray.appendUndefined):
(WebInspector.ConsoleMessageImpl.prototype._printArray):

LayoutTests:

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (108510 => 108511)


--- trunk/LayoutTests/ChangeLog	2012-02-22 17:26:14 UTC (rev 108510)
+++ trunk/LayoutTests/ChangeLog	2012-02-22 17:39:03 UTC (rev 108511)
@@ -1,3 +1,15 @@
+2012-02-22  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: console doesn't show properly arrays from which tail values have been deleted
+        https://bugs.webkit.org/show_bug.cgi?id=79242
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/console/console-format-expected.txt:
+        * inspector/console/console-format.html:
+        * platform/chromium/inspector/console/console-format-collections-expected.txt:
+        * platform/chromium/inspector/console/console-format-expected.txt:
+
 2012-02-22  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: [REGRESSION] Console xhr logging is broken for async xhrs since r107672.

Modified: trunk/LayoutTests/inspector/console/console-format-expected.txt (108510 => 108511)


--- trunk/LayoutTests/inspector/console/console-format-expected.txt	2012-02-22 17:26:14 UTC (rev 108510)
+++ trunk/LayoutTests/inspector/console/console-format-expected.txt	2012-02-22 17:39:03 UTC (rev 108511)
@@ -1,7 +1,7 @@
 CONSOLE MESSAGE: line 12: Message format number %i, %d and %f
 CONSOLE MESSAGE: line 13: Message %s for %s
 CONSOLE MESSAGE: line 14: Object %o
-CONSOLE MESSAGE: line 20: test,test2,,,test4
+CONSOLE MESSAGE: line 20: test,test2,,,test4,,,,,
 CONSOLE MESSAGE: line 21: %o
 CONSOLE MESSAGE: line 22: %O
 CONSOLE MESSAGE: line 54: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
@@ -51,9 +51,9 @@
 console-format.html:12Message format number 1, 2 and 3.5
 console-format.html:13Message format for string
 console-format.html:14Object Object
-console-format.html:20["test", "test2", undefined, undefined, "test4"]
-console-format.html:21["test", "test2", undefined, undefined, "test4"]
-console-format.html:22Array[5]
+console-format.html:20["test", "test2", undefined × 2, "test4", undefined × 5]
+console-format.html:21["test", "test2", undefined × 2, "test4", undefined × 5]
+console-format.html:22Array[10]
 console-format.html:54/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
 console-format.html:55[/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
 globals[0]

Modified: trunk/LayoutTests/inspector/console/console-format.html (108510 => 108511)


--- trunk/LayoutTests/inspector/console/console-format.html	2012-02-22 17:26:14 UTC (rev 108510)
+++ trunk/LayoutTests/inspector/console/console-format.html	2012-02-22 17:39:03 UTC (rev 108511)
@@ -13,7 +13,7 @@
     console.log('Message %s for %s', 'format', 'string');
     console.log('Object %o', {'foo' : 'bar' });
 
-    var array = ["test", "test2"];
+    var array = ["test", "test2"]; array.length = 10;
     array.foo = "bar"; 
     array[4] = "test4";
 

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


--- trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt	2012-02-22 17:26:14 UTC (rev 108510)
+++ trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt	2012-02-22 17:39:03 UTC (rev 108511)
@@ -9,7 +9,7 @@
 
 console-format-collections.html:15[<select id="sel" name="sel">…</select>]
 console-format-collections.html:19[<script src="" <script src="" <script>…</script>]
-console-format-collections.html:23[]
+console-format-collections.html:23[undefined × 2]
 console-format-collections.html:27[<html>…</html>, <head>…</head>, <script src="" <script src="" <script>…</script>, <body _onload_="onload()">…</body>, <p>
 Tests that console nicely formats HTML Collections and NodeLists.
 </p>, <div style="display:none">…</div>, <form id="f">…</form>, <select id="sel" name="sel">…</select>, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]

Modified: trunk/LayoutTests/platform/chromium/inspector/console/console-format-expected.txt (108510 => 108511)


--- trunk/LayoutTests/platform/chromium/inspector/console/console-format-expected.txt	2012-02-22 17:26:14 UTC (rev 108510)
+++ trunk/LayoutTests/platform/chromium/inspector/console/console-format-expected.txt	2012-02-22 17:39:03 UTC (rev 108511)
@@ -1,7 +1,7 @@
 CONSOLE MESSAGE: line 12: Message format number %i, %d and %f
 CONSOLE MESSAGE: line 13: Message %s for %s
 CONSOLE MESSAGE: line 14: Object %o
-CONSOLE MESSAGE: line 20: test,test2,,,test4
+CONSOLE MESSAGE: line 20: test,test2,,,test4,,,,,
 CONSOLE MESSAGE: line 21: %o
 CONSOLE MESSAGE: line 22: %O
 CONSOLE MESSAGE: line 54: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
@@ -51,9 +51,9 @@
 console-format.html:12Message format number 1, 2 and 3.5
 console-format.html:13Message format for string
 console-format.html:14Object Object
-console-format.html:20["test", "test2", undefined, undefined, "test4"]
-console-format.html:21["test", "test2", undefined, undefined, "test4"]
-console-format.html:22Array[5]
+console-format.html:20["test", "test2", undefined × 2, "test4", undefined × 5]
+console-format.html:21["test", "test2", undefined × 2, "test4", undefined × 5]
+console-format.html:22Array[10]
 console-format.html:54/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
 console-format.html:55[/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
 globals[0]

Modified: trunk/Source/WebCore/ChangeLog (108510 => 108511)


--- trunk/Source/WebCore/ChangeLog	2012-02-22 17:26:14 UTC (rev 108510)
+++ trunk/Source/WebCore/ChangeLog	2012-02-22 17:39:03 UTC (rev 108511)
@@ -1,5 +1,17 @@
 2012-02-22  Pavel Feldman  <pfeld...@google.com>
 
+        Web Inspector: console doesn't show properly arrays from which tail values have been deleted
+        https://bugs.webkit.org/show_bug.cgi?id=79242
+
+        Reviewed by Yury Semikhatsky.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/ConsoleMessage.js:
+        (WebInspector.ConsoleMessageImpl.prototype._printArray.appendUndefined):
+        (WebInspector.ConsoleMessageImpl.prototype._printArray):
+
+2012-02-22  Pavel Feldman  <pfeld...@google.com>
+
         Web Inspector: warning external font mime (font/font/woff).
         https://bugs.webkit.org/show_bug.cgi?id=79244
 

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js (108510 => 108511)


--- trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js	2012-02-22 17:26:14 UTC (rev 108510)
+++ trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js	2012-02-22 17:39:03 UTC (rev 108511)
@@ -310,22 +310,44 @@
             return;
 
         var elements = [];
+        var length = 0;
         for (var i = 0; i < properties.length; ++i) {
-            var name = properties[i].name;
+            var property = properties[i];
+            var name = property.name;
+            if (name === "length")
+                length = parseInt(property.value.description, 10);
             if (name == parseInt(name, 10))
-                elements[name] = this._formatAsArrayEntry(properties[i].value);
+                elements[name] = this._formatAsArrayEntry(property.value);
         }
 
         elem.appendChild(document.createTextNode("["));
-        for (var i = 0; i < elements.length; ++i) {
+        var lastNonEmptyIndex = -1;
+
+        function appendUndefined(elem, index)
+        {
+            if (index - lastNonEmptyIndex <= 1)
+                return;
+            var span = elem.createChild(span, "console-formatted-undefined");
+            span.textContent = WebInspector.UIString("undefined × %d", index - lastNonEmptyIndex - 1);
+        }
+
+        for (var i = 0; i < length; ++i) {
             var element = elements[i];
-            if (element)
-                elem.appendChild(element);
-            else
-                elem.appendChild(document.createTextNode("undefined"))
-            if (i < elements.length - 1)
+            if (!element)
+                continue;
+
+            if (i - lastNonEmptyIndex > 1) {
+                appendUndefined(elem, i);
                 elem.appendChild(document.createTextNode(", "));
-        }
+            }
+
+            elem.appendChild(element);
+            lastNonEmptyIndex = i;
+            if (i < length - 1)
+                elem.appendChild(document.createTextNode(", "));
+        }       
+        appendUndefined(elem, length);
+
         elem.appendChild(document.createTextNode("]"));
     },
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to