forked from mirrors/gecko-dev
Bug 1872673 - Remove 'console' export from Console.sys.mjs, use alternative logging where required. r=mossop,devtools-reviewers,nchevobbe
Depends on D197502 Differential Revision: https://phabricator.services.mozilla.com/D197503
This commit is contained in:
parent
0b3c310c66
commit
4a96e178e3
6 changed files with 8 additions and 25 deletions
|
|
@ -10,9 +10,6 @@ add_task(async function testCategoryLogs() {
|
||||||
const storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage);
|
const storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage);
|
||||||
storage.clearEvents();
|
storage.clearEvents();
|
||||||
|
|
||||||
const { console } = ChromeUtils.importESModule(
|
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
|
||||||
);
|
|
||||||
console.log("bug861338-log-cached");
|
console.log("bug861338-log-cached");
|
||||||
|
|
||||||
const hud = await BrowserConsoleManager.toggleBrowserConsole();
|
const hud = await BrowserConsoleManager.toggleBrowserConsole();
|
||||||
|
|
@ -88,9 +85,10 @@ add_task(async function testFilter() {
|
||||||
add_task(async function testProfile() {
|
add_task(async function testProfile() {
|
||||||
const consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"];
|
const consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"];
|
||||||
const storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage);
|
const storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage);
|
||||||
const { console } = ChromeUtils.importESModule(
|
const { ConsoleAPI } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
"resource://gre/modules/Console.sys.mjs"
|
||||||
);
|
);
|
||||||
|
const console = new ConsoleAPI();
|
||||||
|
|
||||||
storage.clearEvents();
|
storage.clearEvents();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { console, ConsoleAPI } = ChromeUtils.importESModule(
|
const { ConsoleAPI } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
"resource://gre/modules/Console.sys.mjs"
|
||||||
);
|
);
|
||||||
const {
|
const {
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,6 @@ This tutorial was tested against Firefox 58 Beta and Nightly. It does not work i
|
||||||
const { addDebuggerToGlobal } = ChromeUtils.importESModule(
|
const { addDebuggerToGlobal } = ChromeUtils.importESModule(
|
||||||
"resource://gre/modules/jsdebugger.sys.mjs"
|
"resource://gre/modules/jsdebugger.sys.mjs"
|
||||||
);
|
);
|
||||||
const { console } = ChromeUtils.importESModule(
|
|
||||||
"resource://gre/modules/Console.sys.mjs"
|
|
||||||
);
|
|
||||||
|
|
||||||
// This simply defines 'Debugger' in this Scratchpad;
|
// This simply defines 'Debugger' in this Scratchpad;
|
||||||
// it doesn't actually start debugging anything.
|
// it doesn't actually start debugging anything.
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,10 @@ var WindowListener = {
|
||||||
// needs to happen in all navigator:browser windows should go here.
|
// needs to happen in all navigator:browser windows should go here.
|
||||||
setupWindow(win) {
|
setupWindow(win) {
|
||||||
win.nativeConsole = win.console;
|
win.nativeConsole = win.console;
|
||||||
ChromeUtils.defineESModuleGetters(win, {
|
let { ConsoleAPI } = ChromeUtils.importESModule(
|
||||||
console: "resource://gre/modules/Console.sys.mjs",
|
"resource://gre/modules/Console.sys.mjs"
|
||||||
});
|
);
|
||||||
|
win.console = new ConsoleAPI();
|
||||||
},
|
},
|
||||||
|
|
||||||
tearDownWindow(win) {
|
tearDownWindow(win) {
|
||||||
|
|
|
||||||
|
|
@ -751,5 +751,3 @@ ConsoleAPI.prototype = {
|
||||||
return shouldLog(aLevel, this.maxLogLevel);
|
return shouldLog(aLevel, this.maxLogLevel);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export var console = new ConsoleAPI();
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
const lazy = {};
|
|
||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
|
||||||
console: "resource://gre/modules/Console.sys.mjs",
|
|
||||||
});
|
|
||||||
|
|
||||||
export function EventEmitter() {}
|
export function EventEmitter() {}
|
||||||
|
|
||||||
let loggingEnabled = Services.prefs.getBoolPref("toolkit.dump.emit");
|
let loggingEnabled = Services.prefs.getBoolPref("toolkit.dump.emit");
|
||||||
|
|
@ -153,12 +147,7 @@ EventEmitter.prototype = {
|
||||||
try {
|
try {
|
||||||
listener.apply(null, arguments);
|
listener.apply(null, arguments);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// Prevent a bad listener from interfering with the others.
|
console.error(ex);
|
||||||
let msg = ex + ": " + ex.stack;
|
|
||||||
lazy.console.error(msg);
|
|
||||||
if (loggingEnabled) {
|
|
||||||
dump(msg + "\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue