mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 11:37:43 -10:00
This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 1` argument. Differential Revision: https://phabricator.services.mozilla.com/D26812
74 lines
1.6 KiB
HTML
74 lines
1.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf8">
|
|
<title>Test for nsIConsoleMessages</title>
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="common.js"></script>
|
|
<!-- Any copyright is dedicated to the Public Domain.
|
|
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
</head>
|
|
<body>
|
|
<p>Make sure that nsIConsoleMessages are logged. See bug 859756.</p>
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
"use strict";
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
let expectedMessages = [];
|
|
|
|
function startTest()
|
|
{
|
|
removeEventListener("load", startTest);
|
|
attachConsole(["PageError"], onAttach);
|
|
}
|
|
|
|
function onAttach(aState, aResponse)
|
|
{
|
|
onLogMessage = onLogMessage.bind(null, aState);
|
|
aState.client.on("logMessage", onLogMessage);
|
|
|
|
expectedMessages = [{
|
|
message: "hello world! bug859756",
|
|
timeStamp: /^\d+$/,
|
|
}];
|
|
|
|
Services.console.logStringMessage("hello world! bug859756");
|
|
|
|
info("waiting for messages");
|
|
}
|
|
|
|
let receivedMessages = [];
|
|
|
|
function onLogMessage(aState, aPacket)
|
|
{
|
|
info("received message: " + aPacket.message);
|
|
|
|
let found = false;
|
|
for (let expected of expectedMessages) {
|
|
if (expected.message == aPacket.message) {
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!found) {
|
|
return;
|
|
}
|
|
|
|
receivedMessages.push(aPacket);
|
|
if (receivedMessages.length != expectedMessages.length) {
|
|
return;
|
|
}
|
|
|
|
aState.client.off("logMessage", onLogMessage);
|
|
|
|
checkObject(receivedMessages, expectedMessages);
|
|
|
|
closeDebugger(aState, () => SimpleTest.finish());
|
|
}
|
|
|
|
addEventListener("load", startTest);
|
|
</script>
|
|
</body>
|
|
</html>
|