Bug 1030464 - log mozApps debug messages only if pref is set; r=fabrice

This commit is contained in:
Myk Melez 2014-06-30 17:27:34 -07:00
parent e19859bbb6
commit d1872c6bfd
2 changed files with 13 additions and 7 deletions

View File

@ -74,16 +74,16 @@ XPCOMUtils.defineLazyGetter(this, "libcutils", function() {
#ifdef MOZ_WIDGET_ANDROID
// On Android, define the "debug" function as a binding of the "d" function
// from the AndroidLog module so it gets the "debug" priority and a log tag.
// We always report debug messages on Android because it's hard to use a debug
// build on Android and unnecessary to restrict reporting, per bug 1003469.
// We always report debug messages on Android because it's unnecessary
// to restrict reporting, per bug 1003469.
let debug = Cu.import("resource://gre/modules/AndroidLog.jsm", {})
.AndroidLog.d.bind(null, "Webapps");
#else
function debug(aMsg) {
#ifdef DEBUG
dump("-*- Webapps.jsm : " + aMsg + "\n");
#endif
}
// Elsewhere, report debug messages only if dom.mozApps.debug is set to true.
// The pref is only checked once, on startup, so restart after changing it.
let debug = Services.prefs.getBoolPref("dom.mozApps.debug")
? (aMsg) => dump("-*- Webapps.jsm : " + aMsg + "\n")
: (aMsg) => {};
#endif
function getNSPRErrorCode(err) {

View File

@ -4049,6 +4049,12 @@ pref("dom.mozApps.maxLocalId", 1000);
// different stages (dev, staging, prod) of the same app store.
pref("dom.mozApps.signed_apps_installable_from", "https://marketplace.firefox.com");
// Whether or not to dump mozApps debug messages to the console.
// Only checked on startup, so restart after changing this pref.
// Ignored on Android, where we always report debug messages because it's
// unnecessary to restrict reporting, per bug 1003469.
pref("dom.mozApps.debug", false);
// Minimum delay in milliseconds between network activity notifications (0 means
// no notifications). The delay is the same for both download and upload, though
// they are handled separately. This pref is only read once at startup: