mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1159929 - Cache the pref value for devtools.dump.emit in event emitter;r=fitzgen
This commit is contained in:
parent
c7e0b742a2
commit
89e2259a7f
@ -25,6 +25,16 @@ module.exports = EventEmitter;
|
||||
const { Cu, components } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const promise = require("promise");
|
||||
let loggingEnabled = true;
|
||||
|
||||
if (!isWorker) {
|
||||
loggingEnabled = Services.prefs.getBoolPref("devtools.dump.emit");
|
||||
Services.prefs.addObserver("devtools.dump.emit", {
|
||||
observe: () => {
|
||||
loggingEnabled = Services.prefs.getBoolPref("devtools.dump.emit");
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorate an object with event emitter functionality.
|
||||
@ -147,9 +157,10 @@ EventEmitter.prototype = {
|
||||
},
|
||||
|
||||
logEvent: function(aEvent, args) {
|
||||
let logging = isWorker ? true : Services.prefs.getBoolPref("devtools.dump.emit");
|
||||
if (!loggingEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (logging) {
|
||||
let caller, func, path;
|
||||
if (!isWorker) {
|
||||
caller = components.stack.caller.caller;
|
||||
@ -200,7 +211,6 @@ EventEmitter.prototype = {
|
||||
out += "emit" + argOut + " from " + func + "() -> " + path + "\n";
|
||||
|
||||
dump(out);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user