Bug 1085296 - B2G NFC: enable debug when either flag is enabled or settings is enabled. r=dimi

This commit is contained in:
Yoshi Huang 2014-11-24 10:10:32 +08:00
parent 521d825ca2
commit de0386e48c
3 changed files with 10 additions and 8 deletions

View File

@ -37,7 +37,7 @@ let DEBUG = NFC.DEBUG_CONTENT_HELPER;
let debug;
function updateDebug() {
if (DEBUG) {
if (DEBUG || NFC.DEBUG_CONTENT_HELPER) {
debug = function (s) {
dump("-*- NfcContentHelper: " + s + "\n");
};
@ -99,7 +99,7 @@ NfcContentHelper.prototype = {
this._window = aWindow;
this.initDOMRequestHelper(this._window, NFC_IPC_MSG_NAMES);
if (this._window.navigator.mozSettings) {
if (!NFC.DEBUG_CONTENT_HELPER && this._window.navigator.mozSettings) {
let lock = this._window.navigator.mozSettings.createLock();
var nfcDebug = lock.get(NFC.SETTING_NFC_DEBUG);
nfcDebug.onsuccess = function _nfcDebug() {

View File

@ -40,7 +40,7 @@ let DEBUG = NFC.DEBUG_NFC;
let debug;
function updateDebug() {
if (DEBUG) {
if (DEBUG || NFC.DEBUG_NFC) {
debug = function (s) {
dump("-*- Nfc: " + s + "\n");
};
@ -108,10 +108,12 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
init: function init(nfc) {
this.nfc = nfc;
let lock = gSettingsService.createLock();
lock.get(NFC.SETTING_NFC_DEBUG, this.nfc);
if (!NFC.DEBUG_NFC) {
let lock = gSettingsService.createLock();
lock.get(NFC.SETTING_NFC_DEBUG, this.nfc);
Services.obs.addObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED, false);
}
Services.obs.addObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED, false);
Services.obs.addObserver(this, NFC.TOPIC_XPCOM_SHUTDOWN, false);
this._registerMessageListeners();
},

View File

@ -19,8 +19,8 @@
this.DEBUG_ALL = false;
// Set individually to debug specific layers
this.DEBUG_CONTENT_HELPER = false || DEBUG_ALL;
this.DEBUG_NFC = false || DEBUG_ALL;
this.DEBUG_CONTENT_HELPER = DEBUG_ALL || false;
this.DEBUG_NFC = DEBUG_ALL || false;
// Gecko specific error codes
this.NFC_GECKO_SUCCESS = 0;