blob: 6f933eda4a6ce96d0eeb2c7ad0845382941e948b [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
var john = new Person("John", "Smith");
var jane = new Person("Jane", "Doe");
var emily = new Person("Emily", "Jones");
var manyProperties = {one:1, two:2, three:3, four:4, five:5, six:6};
function test()
{
var currentStepIndex = 0;
var steps = [
"console.table([])", // Empty.
"console.table(['apple', 'orange', 'banana'])", // Index (array index), Value
"console.table({firstName: 'John', lastName: 'Smith'})", // Index (property name), Value (property value)
"console.table({f: function(){}, x: 10})", // Index (property name), Value (property value)
"console.table([['John', 'Smith'], ['Jane', 'Doe'], ['Emily', 'Jones']])", // Index, 0, 1
"console.table([john, jane, emily])", // Index, firstName, lastName
"console.table([john, jane, emily], ['firstName'])", // Index, firstName (at least).
`console.table([manyProperties, manyProperties], ['five', 'six'])`, // Index, five, size (at least)
];
function remoteObjectJSONFilter(key, value)
{
if (key === "_target" || key === "_listeners")
return undefined;
if (key === "_objectId" || key === "_stackTrace")
return "<filtered>";
return value;
}
WI.consoleManager.addEventListener(WI.ConsoleManager.Event.MessageAdded, function(event) {
var message = event.data.message;
InspectorTest.assert(message instanceof WI.ConsoleMessage);
InspectorTest.log("\nSTEP: " + steps[currentStepIndex]);
InspectorTest.log(JSON.stringify(message, remoteObjectJSONFilter, " "));
if (++currentStepIndex >= steps.length)
InspectorTest.completeTest();
});
for (var step of steps)
WI.runtimeManager.evaluateInInspectedWindow(step, {objectGroup: "test", doNotPauseOnExceptionsAndMuteConsole: true, generatePreview: true}, function(){});
}
</script>
</head>
<body onload="runTest()">
</body>
</html>