Bug 1452143: Fix webconsole tests. r=jryans

MozReview-Commit-ID: ClzJ0Ee1n5I
This commit is contained in:
Emilio Cobos Álvarez 2018-04-16 16:39:41 +02:00
Родитель 7ace302174
Коммит f1e24af91b
3 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -370,6 +370,7 @@ async function generateCssMessageStubs() {
gBrowser.selectedBrowser,
[key, code],
function([subKey, subCode]) {
content.document.docShell.cssErrorReportingEnabled = true;
let style = content.document.createElement("style");
// eslint-disable-next-line no-unsanitized/property
style.innerHTML = subCode;

Просмотреть файл

@ -25,17 +25,18 @@ add_task(async function() {
info("Open the console");
let hud = await openConsole();
testMessagesVisibility(hud);
await testMessagesVisibility(hud, true);
info("Close the toolbox");
await closeToolbox();
info("Open the console again");
hud = await openConsole();
testMessagesVisibility(hud);
await testMessagesVisibility(hud, false);
});
function testMessagesVisibility(hud) {
async function testMessagesVisibility(hud, waitForCSSMessage) {
let message = findMessage(hud, "log Bazzle", ".message.log");
ok(message, "console.log message is visible");
@ -45,6 +46,11 @@ function testMessagesVisibility(hud) {
message = findMessage(hud, "bazBug611032", ".message.error");
ok(message, "exception message is visible");
// The CSS message arrives lazily, so spin a bit for it unless it should be
// cached.
if (waitForCSSMessage) {
await waitForMessage(hud, "cssColorBug611032");
}
message = findMessage(hud, "cssColorBug611032", ".message.warn.css");
ok(message, "css warning message is visible");
}

Просмотреть файл

@ -12,6 +12,7 @@
<p>Test for cached messages</p>
<script class="testbody" type="application/javascript">
document.docShell.cssErrorReportingEnabled = true;
var ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"]
.getService(Ci.nsIConsoleAPIStorage);
let expectedConsoleCalls = [];