Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: LayoutTests/inspector/console/console-format-array-prototype.html

Issue 143263003: DevTools: Fix console.log for arrays in some corner cases. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/console/console-format-array-prototype.html
diff --git a/LayoutTests/inspector/console/console-format-array-prototype.html b/LayoutTests/inspector/console/console-format-array-prototype.html
new file mode 100644
index 0000000000000000000000000000000000000000..a3aa7275666dfc6ca206386264158f20fc63b1d9
--- /dev/null
+++ b/LayoutTests/inspector/console/console-format-array-prototype.html
@@ -0,0 +1,70 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/console-test.js"></script>
+<script>
+
+Array.prototype[0] = "proto0";
+Array.prototype[10] = "proto10";
+
+function tearDown()
+{
+ delete Array.prototype[0];
+ delete Array.prototype[10];
+}
+
+var a0 = [];
+var a1 = []; a1.length = 1;
+var a2 = [,2,3];
+var a3 = []; a3.length = 15;
+var a4 = []; a4.length = 15; a4[8] = 8;
+var a5 = []; a5.length = 15; a5[0] = 0; a5[10] = 10;
+
+var a6 = [,,,4]; a6.length = 15;
+for (var i = 0; i < 6; ++i)
+ a6["index" + i] = i;
+
+function test()
+{
+ loopOverGlobals(0, 7);
+
+ function loopOverGlobals(current, total)
+ {
+ function advance()
+ {
+ var next = current + 1;
+ if (next === total) {
+ InspectorTest.evaluateInPage("tearDown()");
+ InspectorTest.expandConsoleMessages();
+ InspectorTest.runAfterPendingDispatches(finish);
+ } else {
+ loopOverGlobals(next, total);
+ }
+ }
+
+ function finish()
+ {
+ var text = InspectorTest.textContentWithLineBreaks(WebInspector.consoleView.topGroup.element);
+ text = text.replace(/\bVM\d+/g, "VM");
+ InspectorTest.addResult(text);
+ InspectorTest.completeTest();
+ }
+
+ InspectorTest.evaluateInConsole("a" + current);
+ InspectorTest.runAfterPendingDispatches(evalInConsole);
+ function evalInConsole()
+ {
+ InspectorTest.evaluateInPage("console.log(a" + current + ")");
+ InspectorTest.runAfterPendingDispatches(advance);
+ }
+ }
+}
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that console logging dumps array values defined on Array.prototype[].
+</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698