Bug 906375 - Bind all the methods in Console.jsm's console object. r=mratcliffe

This commit is contained in:
Dave Camp 2013-08-16 16:45:05 -07:00
parent c7c7176adb
commit a01c5c7e8c

View File

@ -586,6 +586,14 @@ function ConsoleAPI(aConsoleOptions = {}) {
this.dump = aConsoleOptions.dump || dump;
this.prefix = aConsoleOptions.prefix || "";
this.maxLogLevel = aConsoleOptions.maxLogLevel || "all";
// Bind all the functions to this object.
for (let prop in this) {
let desc = Object.getOwnPropertyDescriptor(this, prop);
if (typeof(desc.value) === "function") {
this[prop] = desc.value.bind(this);
}
}
}
ConsoleAPI.prototype = {