blob: 3aa3da33c5958e45aa36c7ba973a548043fd1d72 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/debugger-test.js"></script>
<script>
function f1()
{
console.error("Test message.");
}
var test = function()
{
var panel = WebInspector.panels.scripts;
var worker = new Worker("ScriptFormatterWorker.js");
var sourceFrame;
InspectorTest.runDebuggerTestSuite([
function testConsoleMessagesForFormattedScripts(next)
{
InspectorTest.showScriptSource("script-formatter-console.html", didShowScriptSource);
function didShowScriptSource(frame)
{
sourceFrame = frame;
InspectorTest.evaluateInPage("f1()", didEvaluate);
}
function didEvaluate()
{
dumpConsoleMessageURLs();
InspectorTest.addResult("Pre-format row message list:");
InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._rowMessages)));
InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._messageBubbles)));
sourceFrame._javaScriptSource.setFormatted(true, didFormatLinkText);
}
function didFormatLinkText()
{
dumpConsoleMessageURLs();
InspectorTest.addResult("Post-format row message list:");
InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._rowMessages)));
InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._messageBubbles)));
next();
}
}
]);
function dumpConsoleMessageURLs()
{
var messages = WebInspector.console.messages;
for (var i = 0; i < messages.length; ++i) {
var element = messages[i].toMessageElement();
var anchor = element.querySelector(".console-message-url");
InspectorTest.addResult(anchor.textContent);
}
}
}
</script>
</head>
<body onload="runTest()">
<p>Tests that the script formatting changes console line numbers.
</p>
</body>
</html>