From bc4c528383206e4d8401f99f6da7a70b9168a090 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Fri, 12 Apr 2013 01:51:49 -0700 Subject: [PATCH] Bug 823999 - Add logging to the Contacts code to diagnose intermittent failure. --HG-- extra : rebase_source : 7ded707e14bb280ea93582da5dbd460248518418 --- dom/contacts/ContactManager.js | 4 +++- dom/contacts/fallback/ContactDB.jsm | 4 +++- dom/contacts/fallback/ContactService.jsm | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dom/contacts/ContactManager.js b/dom/contacts/ContactManager.js index 23ffc2d2592..830e7afd79a 100644 --- a/dom/contacts/ContactManager.js +++ b/dom/contacts/ContactManager.js @@ -4,7 +4,7 @@ "use strict"; -const DEBUG = false; +let DEBUG = false; function debug(s) { dump("-*- ContactManager: " + s + "\n"); } const Cc = Components.classes; @@ -637,6 +637,7 @@ ContactManager.prototype = { }, find: function(aOptions) { + DEBUG = false; if (DEBUG) debug("find! " + JSON.stringify(aOptions)); let request = this.createRequest(); let options = { findOptions: aOptions }; @@ -701,6 +702,7 @@ ContactManager.prototype = { }, clear: function() { + DEBUG = true; if (DEBUG) debug("clear"); let request; request = this.createRequest(); diff --git a/dom/contacts/fallback/ContactDB.jsm b/dom/contacts/fallback/ContactDB.jsm index c1179c40f6c..636356b57da 100644 --- a/dom/contacts/fallback/ContactDB.jsm +++ b/dom/contacts/fallback/ContactDB.jsm @@ -6,7 +6,7 @@ this.EXPORTED_SYMBOLS = ['ContactDB']; -const DEBUG = false; +let DEBUG = false; function debug(s) { dump("-*- ContactDB component: " + s + "\n"); } const Cu = Components.utils; @@ -461,6 +461,7 @@ ContactDB.prototype = { }, clear: function clear(aSuccessCb, aErrorCb) { + DEBUG = true; this.newTxn("readwrite", STORE_NAME, function (txn, store) { if (DEBUG) debug("Going to clear all!"); store.clear(); @@ -618,6 +619,7 @@ ContactDB.prototype = { * - count */ find: function find(aSuccessCb, aFailureCb, aOptions) { + DEBUG = false; if (DEBUG) debug("ContactDB:find val:" + aOptions.filterValue + " by: " + aOptions.filterBy + " op: " + aOptions.filterOp); let self = this; this.newTxn("readonly", STORE_NAME, function (txn, store) { diff --git a/dom/contacts/fallback/ContactService.jsm b/dom/contacts/fallback/ContactService.jsm index ab4e9ebd8b6..14613fe83b2 100644 --- a/dom/contacts/fallback/ContactService.jsm +++ b/dom/contacts/fallback/ContactService.jsm @@ -4,7 +4,7 @@ "use strict"; -const DEBUG = false; +let DEBUG = false; function debug(s) { dump("-*- Fallback ContactService component: " + s + "\n"); } const Cu = Components.utils; @@ -90,6 +90,7 @@ let ContactService = { switch (aMessage.name) { case "Contacts:Find": + DEBUG = false; if (!this.assertPermission(aMessage, "contacts-read")) { return null; } @@ -150,6 +151,7 @@ let ContactService = { ); break; case "Contacts:Clear": + DEBUG = true; if (!this.assertPermission(aMessage, "contacts-write")) { return null; }