This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="evaluate-in-frontend.js"></script> | |
<script> | |
function doit() | |
{ | |
var a = ["foo"], b = ["foo"]; | |
console.log(a);console.log(a);console.log(b);console.log(b); | |
function callback(result) | |
{ | |
for (var i = 0; i < result.length; ++i) { | |
output(result[i].text + " " + result[i].clazz); | |
} | |
notifyDone(); | |
} | |
evaluateInWebInspector("dumpMessages()", callback); | |
} | |
</script> | |
</head> | |
<body onload="onload()"> | |
<p> | |
Tests that console logging dumps proper messages. | |
</p> | |
<div id="frontend-script" style="display:none"> | |
function execConsoleCommand(str) | |
{ | |
WebInspector.console.prompt.text = str; | |
var e = document.createEvent("KeyboardEvent"); | |
WebInspector.console._enterKeyPressed(e); | |
} | |
function doitInFrontend() { | |
execConsoleCommand("console.log('bar');console.log('bar');"); | |
execConsoleCommand("console.log('bar');console.log('bar');"); | |
} | |
doitInFrontend(); | |
function dumpMessages() | |
{ | |
var result = []; | |
var messages = WebInspector.console.messages; | |
for (var i = 0; i < messages.length; ++i) { | |
var element = messages[i].toMessageElement(); | |
result.push({ text: element.textContent.replace(/\u200b/g, ""), clazz: element.getAttribute("class")}); | |
} | |
return result; | |
} | |
</div> | |
<div id="output"> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment