blob: dfce66a87bb31727b77eca86ea466fdcaca65dd3 [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)));
InspectorTest.addSniffer(WebInspector.UISourceCode.prototype, "updateLiveLocations", didFormatLinkText);
sourceFrame._uiSourceCode.setFormatted(true);
}
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>