blob: d7c4cb7b82fb038a25f6d017ce9706f2619ad196 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/console-test.js"></script>
<script>
// Global Values
var globals = [];
function onload()
{
var foo = { foo: "foo"};
var bar = { bar: "bar" };
bar.__proto__ = foo;
var array = ["test", "test2"]; array.length = 10;
array.foo = {};
array[4] = "test4";
console.log(array);
console.log("%o", array);
console.log("%O", array);
console.log("Test for zero \"%f\" in formatter", 0);
// Populate Globals
var regex1 = /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i;
var regex2 = new RegExp("foo\\\\bar\\sbaz", "i");
var str = "test";
var str2 = "test named \"test\"";
var node = document.getElementById("p");
var func = function() { return 1; };
var multilinefunc = function() {
return 2;
};
var num = 1.2e-1;
var linkify = "http://webkit.org/";
var valuelessAttribute = document.createAttribute("attr");
var valuedAttribute = document.createAttribute("attr");
valuedAttribute.value = "value";
var existingAttribute = document.getElementById("x").attributes[0];
var throwingLengthGetter = {get length() { throw "Length called"; }};
globals = [
regex1, regex2, str, str2, node, func, multilinefunc, num, linkify,
null, undefined, valuelessAttribute, valuedAttribute, existingAttribute, throwingLengthGetter,
NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array, {}, [function() {}], bar
];
runTest();
}
function log(current)
{
console.log(globals[current]);
console.log([globals[current]]);
}
function test()
{
InspectorTest.evaluateInPage("globals.length", loopOverGlobals.bind(this, 0));
function loopOverGlobals(current, total)
{
function advance()
{
var next = current + 1;
if (next == total.description) {
InspectorTest.expandConsoleMessages();
InspectorTest.dumpConsoleMessages();
InspectorTest.completeTest();
} else
loopOverGlobals(next, total);
}
InspectorTest.evaluateInPage("log(" + current + ")");
InspectorTest.runAfterPendingDispatches(evalInConsole);
function evalInConsole()
{
InspectorTest.evaluateInConsole("globals[" + current + "]");
InspectorTest.runAfterPendingDispatches(advance);
}
}
}
</script>
</head>
<body onload="onload()">
<div id="x"></div>
<p id="p">Tests that console logging dumps proper messages.</p>
</body>
</html>