Bug 1399460 - Fix for browser_webconsole_check_stubs_console_api. r=Honza
The test that checked console api stubs was failing because we were trying
to reach the server while the connection was closed, which throws an error.
This patch filters-out log messages in the console output so we don't get
unwanted server communication. The output is not important here since we
are only listening to the consoleAPICall event.
MozReview-Commit-ID: Ay5fQ1CSbLx
--- a/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js
+++ b/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js
@@ -13,16 +13,17 @@
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js",
this);
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
});
+const { PREFS } = require("devtools/client/webconsole/new-console-output/constants");
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages");
const { stubPackets } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index.js");
const {
consoleApi,
cssMessage,
evaluationResult,
networkEvent,
@@ -283,16 +284,19 @@ module.exports = {
stubPackets,
};
`;
}
function* generateConsoleApiStubs() {
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html";
+ // Hiding log messages so we don't get unwanted client/server communication.
+ Services.prefs.setBoolPref(PREFS.FILTER.LOG, false);
+
let stubs = {
preparedMessages: [],
packets: [],
};
let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
const hud = toolbox.getCurrentPanel().hud;
let {ui} = hud;
@@ -325,16 +329,18 @@ function* generateConsoleApiStubs() {
content.wrappedJSObject.triggerPacket();
script.remove();
}
);
yield received;
}
+ Services.prefs.clearUserPref(PREFS.FILTER.LOG);
+
yield closeTabAndToolbox();
return formatFile(stubs, "ConsoleMessage");
}
function* generateCssMessageStubs() {
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-css-message.html";
let stubs = {