From 0ac54b172cb4c62cf762c5ae1c218cb9f20bacbf Mon Sep 17 00:00:00 2001 From: "pfeldman@chromium.org" Date: Wed, 22 Feb 2012 17:39:03 +0000 Subject: [PATCH] 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: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108511 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 12 +++++++ .../inspector/console/console-format-expected.txt | 8 ++--- LayoutTests/inspector/console/console-format.html | 2 +- .../console-format-collections-expected.txt | 2 +- .../inspector/console/console-format-expected.txt | 8 ++--- Source/WebCore/ChangeLog | 12 +++++++ Source/WebCore/English.lproj/localizedStrings.js | Bin 78556 -> 78666 bytes .../WebCore/inspector/front-end/ConsoleMessage.js | 40 ++++++++++++++++----- 8 files changed, 65 insertions(+), 19 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 40fb0e4..7eb622a 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2012-02-22 Pavel Feldman + + 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 Web Inspector: [REGRESSION] Console xhr logging is broken for async xhrs since r107672. diff --git a/LayoutTests/inspector/console/console-format-expected.txt b/LayoutTests/inspector/console/console-format-expected.txt index a325997..247371f 100644 --- a/LayoutTests/inspector/console/console-format-expected.txt +++ b/LayoutTests/inspector/console/console-format-expected.txt @@ -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 @@ Tests that console logging dumps proper messages. 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] diff --git a/LayoutTests/inspector/console/console-format.html b/LayoutTests/inspector/console/console-format.html index 28772d6..e6440a9 100644 --- a/LayoutTests/inspector/console/console-format.html +++ b/LayoutTests/inspector/console/console-format.html @@ -13,7 +13,7 @@ function onload() 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"; diff --git a/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt b/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt index c94a54a..a4c03ae 100644 --- a/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt +++ b/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt @@ -9,7 +9,7 @@ Tests that console nicely formats HTML Collections and NodeLists. console-format-collections.html:15[] console-format-collections.html:19[, , ] -console-format-collections.html:23[] +console-format-collections.html:23[undefined × 2] console-format-collections.html:27[…, …, , , , …,

Tests that console nicely formats HTML Collections and NodeLists.

,
…
,
…
, , , , , ] diff --git a/LayoutTests/platform/chromium/inspector/console/console-format-expected.txt b/LayoutTests/platform/chromium/inspector/console/console-format-expected.txt index a325997..247371f 100644 --- a/LayoutTests/platform/chromium/inspector/console/console-format-expected.txt +++ b/LayoutTests/platform/chromium/inspector/console/console-format-expected.txt @@ -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 @@ Tests that console logging dumps proper messages. 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] diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 549de96..64f5218 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,5 +1,17 @@ 2012-02-22 Pavel Feldman + 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 + Web Inspector: warning external font mime (font/font/woff). https://bugs.webkit.org/show_bug.cgi?id=79244 diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 1f5a22ca8ab864a43ee810d1677b79f3605d6258..6dcbfa8664549ae5d191c176a3e88b950d5003ef 100644 GIT binary patch delta 69 zcmccfl;zYjmWC~icZ?>_;#B1?WyoVlVMt|2W5@)uQYXLRkyJzz1IjBfTnA!RAWMnC Hnt=-d4u}!+ delta 11 ScmX^0jOET#mWC~icZ>igQ3bsK diff --git a/Source/WebCore/inspector/front-end/ConsoleMessage.js b/Source/WebCore/inspector/front-end/ConsoleMessage.js index 82efcde..f2a74ef 100644 --- a/Source/WebCore/inspector/front-end/ConsoleMessage.js +++ b/Source/WebCore/inspector/front-end/ConsoleMessage.js @@ -310,22 +310,44 @@ WebInspector.ConsoleMessageImpl.prototype = { 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("]")); }, -- 2.7.4