Bug 1406069 - Enable browser_webconsole_cached_messages.js in new console frontend; r=jdescottes.

MozReview-Commit-ID: EypyZoZUWeo

--HG--
extra : rebase_source : e8dac5784aa2fadf6fd31acd2ace1a81d7571516
This commit is contained in:
Nicolas Chevobbe 2017-11-06 09:43:16 +01:00
Родитель edeaf1bc14
Коммит c3429bb148
3 изменённых файлов: 52 добавлений и 48 удалений

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

@ -230,7 +230,6 @@ tags = mcb
skip-if = true # Bug 1403899
# old console skip-if = (os == 'win' && bits == 64) # Bug 1390001
[browser_webconsole_cached_messages.js]
skip-if = true # Bug 1406069
[browser_webconsole_cd_iframe.js]
skip-if = true # Bug 1406030
[browser_webconsole_certificate_messages.js]

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

@ -9,51 +9,41 @@
"use strict";
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
"test/test-webconsole-error-observer.html";
"new-console-output/test/mochitest/test-webconsole-error-observer.html";
// On e10s, the exception is triggered in child process
// and is ignored by test harness
if (!Services.appinfo.browserTabsRemoteAutostart) {
expectUncaughtException();
}
function test() {
waitForExplicitFinish();
loadTab(TEST_URI).then(testOpenUI);
}
function testOpenUI(aTestReopen) {
openConsole().then((hud) => {
waitForMessages({
webconsole: hud,
messages: [
{
text: "log Bazzle",
category: CATEGORY_WEBDEV,
severity: SEVERITY_LOG,
},
{
text: "error Bazzle",
category: CATEGORY_WEBDEV,
severity: SEVERITY_ERROR,
},
{
text: "bazBug611032",
category: CATEGORY_JS,
severity: SEVERITY_ERROR,
},
{
text: "cssColorBug611032",
category: CATEGORY_CSS,
severity: SEVERITY_WARNING,
},
],
}).then(() => {
closeConsole(gBrowser.selectedTab).then(() => {
aTestReopen && info("will reopen the Web Console");
executeSoon(aTestReopen ? testOpenUI : finishTest);
});
});
});
add_task(async function() {
// On e10s, the exception is triggered in child process
// and is ignored by test harness
if (!Services.appinfo.browserTabsRemoteAutostart) {
expectUncaughtException();
}
// Enable CSS filter for the test.
await pushPref("devtools.webconsole.filter.css", true);
await addTab(TEST_URI);
info("Open the console");
let hud = await openConsole();
testMessagesVisibility(hud);
info("Close the toolbox");
await closeToolbox();
info("Open the console again");
hud = await openConsole();
testMessagesVisibility(hud);
});
function testMessagesVisibility(hud) {
let message = findMessage(hud, "log Bazzle", ".message.log");
ok(message, "console.log message is visible");
message = findMessage(hud, "error Bazzle", ".message.error");
ok(message, "console.error message is visible");
message = findMessage(hud, "bazBug611032", ".message.error");
ok(message, "exception message is visible");
message = findMessage(hud, "cssColorBug611032", ".message.warn.css");
ok(message, "css warning message is visible");
}

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

@ -6,7 +6,7 @@
/* exported WCUL10n, openNewTabAndConsole, waitForMessages, waitForMessage, waitFor,
findMessage, openContextMenu, hideContextMenu, loadDocument, hasFocus,
waitForNodeMutation, testOpenInDebugger, checkClickOnNode, jstermSetValueAndComplete,
openDebugger */
openDebugger, openConsole */
"use strict";
@ -349,3 +349,18 @@ async function openDebugger(options = {}) {
await panel.panelWin.DebuggerController.waitForSourcesLoaded();
return {target, toolbox, panel};
}
/**
* Open the Web Console for the given tab, or the current one if none given.
*
* @param nsIDOMElement tab
* Optional tab element for which you want open the Web Console.
* Defaults to current selected tab.
* @return Promise
* A promise that is resolved with the console hud once the web console is open.
*/
async function openConsole(tab) {
let target = TargetFactory.forTab(tab || gBrowser.selectedTab);
const toolbox = await gDevTools.showToolbox(target, "webconsole");
return toolbox.getCurrentPanel().hud;
};