Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / console / console-log-side-effects.html
blobfcbd86fb5f4352dadc4acf94cd3ef574925c942e
1 <html>
2 <head>
3 <script>
5 function overrideToString()
7 console.error("FAIL: side effects, should not be called.");
8 return "FAIL";
11 function test()
13 [Object, Array, Number, Boolean, String, Uint32Array, Node, Element].forEach(function(type) {
14 type.prototype.toString = overrideToString;
15 });
17 console.log("string");
18 console.log(42);
19 console.log(false);
20 console.log(undefined);
21 console.log(null);
22 console.log(NaN);
23 console.log(-Infinity);
24 console.log(-0);
25 console.log(new Number(42));
26 console.log(new Number(-42.42e-12));
27 console.log(new Boolean(true));
28 console.log(new String("foo"));
29 console.log({ __proto__: null });
30 console.log(window);
32 // Test DOMWrapper object.
33 var node = document.getElementById("node");
34 node.toString = overrideToString;
35 node.__proto__.toString = overrideToString;
36 console.log(node);
38 var obj = { foo: 1, bar: 2 };
39 var arr = [1, 2, 3];
40 console.log(obj);
41 console.log(arr);
43 console.log(new Uint32Array([1, 2, 3]));
45 arr.push(obj);
46 console.log(arr);
48 var overridden = { toString: overrideToString };
49 console.log(overridden);
51 arr.push(overridden);
52 console.log(arr);
54 // Test recursive arrays.
55 var a1 = [[1, [[2], 3], [[[[4]]], 5]]];
56 var a2 = []; a2[3] = null; a2[5] = NaN;
57 a1.push(a2);
58 a2.push(a1);
59 var a3 = [[a1], [[a2]]];
60 a3.push(a3);
61 console.log(a3);
63 // This used to timeout.
64 var timeout = { toString: function() { while (true) {} } };
65 console.log(timeout);
67 arr.push(timeout);
68 console.log(arr);
70 // This used to crash out of memory.
71 const maxArrayLength = 4294967295;
72 for (var i = 100000; i < maxArrayLength; i *= 10) {
73 arr[i] = i;
74 console.log(arr);
76 arr[maxArrayLength - 1] = a3;
77 console.log(arr);
79 // Test array length limit.
80 const arrayLengthLimit = 10000;
81 var arr = [];
82 for (var i = 0; i < arrayLengthLimit + 1; ++i)
83 arr[i] = i;
84 console.log(arr);
86 // Test array stack depth limit.
87 var arr = [];
88 for (var i = 0; i < arrayLengthLimit; ++i)
89 arr = [arr];
90 console.log(arr);
93 function runTest()
95 if (window.testRunner) {
96 testRunner.dumpAsText();
97 testRunner.waitUntilDone();
99 try {
100 test();
101 } finally {
102 if (window.testRunner)
103 testRunner.notifyDone();
107 </script>
108 </head>
109 <body onload="runTest()">
110 <p id ="node">
111 Tests various extreme usages of console.log()
112 </p>
113 </body>
114 </html>