OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 // Global Values | 7 // Global Values |
8 var globals = []; | 8 var globals = []; |
9 | 9 |
10 function log(current) | 10 function log(current) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 var valuedAttribute = document.createAttribute("attr"); | 45 var valuedAttribute = document.createAttribute("attr"); |
46 valuedAttribute.value = "value"; | 46 valuedAttribute.value = "value"; |
47 var existingAttribute = document.getElementById("x").attributes[0]; | 47 var existingAttribute = document.getElementById("x").attributes[0]; |
48 var throwingLengthGetter = {get length() { throw "Length called"; }}; | 48 var throwingLengthGetter = {get length() { throw "Length called"; }}; |
49 var objectWithNonEnumerables = Object.create({ foo: 1 }, { | 49 var objectWithNonEnumerables = Object.create({ foo: 1 }, { |
50 getFoo: { value: function() { return this.foo; } }, | 50 getFoo: { value: function() { return this.foo; } }, |
51 bar: { get: function() { return this.bar; }, set: function(x) { this.bar
= x; } } | 51 bar: { get: function() { return this.bar; }, set: function(x) { this.bar
= x; } } |
52 }); | 52 }); |
53 var negZero = 1 / Number.NEGATIVE_INFINITY; | 53 var negZero = 1 / Number.NEGATIVE_INFINITY; |
54 | 54 |
| 55 var arrayWithNonIndexOverflow = [1,2,3,4]; |
| 56 for (var i = 0; i < 6; ++i) |
| 57 arrayWithNonIndexOverflow["index" + i] = i; |
| 58 |
55 globals = [ | 59 globals = [ |
56 regex1, regex2, str, str2, error, errorWithMessage, node, func, multilin
efunc, num, linkify, | 60 regex1, regex2, str, str2, error, errorWithMessage, node, func, multilin
efunc, num, linkify, |
57 null, undefined, valuelessAttribute, valuedAttribute, existingAttribute,
throwingLengthGetter, | 61 null, undefined, valuelessAttribute, valuedAttribute, existingAttribute,
throwingLengthGetter, |
58 NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array, {}, [fun
ction() {}], bar, svg, | 62 NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array, arrayWit
hNonIndexOverflow, {}, |
59 objectWithNonEnumerables, negZero, Object.create(null), Object, Object.p
rototype | 63 [function() {}], bar, svg, objectWithNonEnumerables, negZero, Object.cre
ate(null), Object, Object.prototype |
60 ]; | 64 ]; |
61 | 65 |
62 runTest(); | 66 runTest(); |
63 } | 67 } |
64 | 68 |
65 function test() | 69 function test() |
66 { | 70 { |
67 InspectorTest.evaluateInPage("globals.length", loopOverGlobals.bind(this, 0)
); | 71 InspectorTest.evaluateInPage("globals.length", loopOverGlobals.bind(this, 0)
); |
68 | 72 |
69 function loopOverGlobals(current, total) | 73 function loopOverGlobals(current, total) |
70 { | 74 { |
71 function advance() | 75 function advance() |
72 { | 76 { |
73 var next = current + 1; | 77 var next = current + 1; |
74 if (next == total.description) { | 78 if (next == total.description) { |
75 InspectorTest.expandConsoleMessages(); | 79 InspectorTest.expandConsoleMessages(); |
76 InspectorTest.runAfterPendingDispatches(finish); | 80 InspectorTest.runAfterPendingDispatches(finish); |
77 } else { | 81 } else { |
78 loopOverGlobals(next, total); | 82 loopOverGlobals(next, total); |
79 } | 83 } |
80 } | 84 } |
81 | 85 |
82 function finish() | 86 function finish() |
83 { | 87 { |
84 InspectorTest.dumpConsoleMessages(); | 88 var text = InspectorTest.textContentWithLineBreaks(WebInspector.cons
oleView.topGroup.element); |
| 89 text = text.replace(/\bVM\d+/g, "VM"); |
| 90 InspectorTest.addResult(text); |
85 InspectorTest.completeTest(); | 91 InspectorTest.completeTest(); |
86 } | 92 } |
87 | 93 |
88 InspectorTest.evaluateInPage("log(" + current + ")"); | 94 InspectorTest.evaluateInPage("log(" + current + ")"); |
89 InspectorTest.runAfterPendingDispatches(evalInConsole); | 95 InspectorTest.runAfterPendingDispatches(evalInConsole); |
90 function evalInConsole() | 96 function evalInConsole() |
91 { | 97 { |
92 InspectorTest.evaluateInConsole("globals[" + current + "]"); | 98 InspectorTest.evaluateInConsole("globals[" + current + "]"); |
93 InspectorTest.runAfterPendingDispatches(advance); | 99 InspectorTest.runAfterPendingDispatches(advance); |
94 } | 100 } |
95 } | 101 } |
96 } | 102 } |
97 </script> | 103 </script> |
98 </head> | 104 </head> |
99 | 105 |
100 <body onload="onload()"> | 106 <body onload="onload()"> |
101 <div id="x"></div> | 107 <div id="x"></div> |
102 <p id="p">Tests that console logging dumps proper messages.</p> | 108 <p id="p">Tests that console logging dumps proper messages.</p> |
103 </body> | 109 </body> |
104 <svg id="svg-node"></svg> | 110 <svg id="svg-node"></svg> |
105 </html> | 111 </html> |
OLD | NEW |