Bug 823999 - Add logging to the Contacts code to diagnose intermittent failure.

--HG--
extra : rebase_source : 7ded707e14bb280ea93582da5dbd460248518418
This commit is contained in:
Reuben Morais 2013-04-12 01:51:49 -07:00
parent 80586339fa
commit bc4c528383
3 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@
"use strict"; "use strict";
const DEBUG = false; let DEBUG = false;
function debug(s) { dump("-*- ContactManager: " + s + "\n"); } function debug(s) { dump("-*- ContactManager: " + s + "\n"); }
const Cc = Components.classes; const Cc = Components.classes;
@ -637,6 +637,7 @@ ContactManager.prototype = {
}, },
find: function(aOptions) { find: function(aOptions) {
DEBUG = false;
if (DEBUG) debug("find! " + JSON.stringify(aOptions)); if (DEBUG) debug("find! " + JSON.stringify(aOptions));
let request = this.createRequest(); let request = this.createRequest();
let options = { findOptions: aOptions }; let options = { findOptions: aOptions };
@ -701,6 +702,7 @@ ContactManager.prototype = {
}, },
clear: function() { clear: function() {
DEBUG = true;
if (DEBUG) debug("clear"); if (DEBUG) debug("clear");
let request; let request;
request = this.createRequest(); request = this.createRequest();

View File

@ -6,7 +6,7 @@
this.EXPORTED_SYMBOLS = ['ContactDB']; this.EXPORTED_SYMBOLS = ['ContactDB'];
const DEBUG = false; let DEBUG = false;
function debug(s) { dump("-*- ContactDB component: " + s + "\n"); } function debug(s) { dump("-*- ContactDB component: " + s + "\n"); }
const Cu = Components.utils; const Cu = Components.utils;
@ -461,6 +461,7 @@ ContactDB.prototype = {
}, },
clear: function clear(aSuccessCb, aErrorCb) { clear: function clear(aSuccessCb, aErrorCb) {
DEBUG = true;
this.newTxn("readwrite", STORE_NAME, function (txn, store) { this.newTxn("readwrite", STORE_NAME, function (txn, store) {
if (DEBUG) debug("Going to clear all!"); if (DEBUG) debug("Going to clear all!");
store.clear(); store.clear();
@ -618,6 +619,7 @@ ContactDB.prototype = {
* - count * - count
*/ */
find: function find(aSuccessCb, aFailureCb, aOptions) { find: function find(aSuccessCb, aFailureCb, aOptions) {
DEBUG = false;
if (DEBUG) debug("ContactDB:find val:" + aOptions.filterValue + " by: " + aOptions.filterBy + " op: " + aOptions.filterOp); if (DEBUG) debug("ContactDB:find val:" + aOptions.filterValue + " by: " + aOptions.filterBy + " op: " + aOptions.filterOp);
let self = this; let self = this;
this.newTxn("readonly", STORE_NAME, function (txn, store) { this.newTxn("readonly", STORE_NAME, function (txn, store) {

View File

@ -4,7 +4,7 @@
"use strict"; "use strict";
const DEBUG = false; let DEBUG = false;
function debug(s) { dump("-*- Fallback ContactService component: " + s + "\n"); } function debug(s) { dump("-*- Fallback ContactService component: " + s + "\n"); }
const Cu = Components.utils; const Cu = Components.utils;
@ -90,6 +90,7 @@ let ContactService = {
switch (aMessage.name) { switch (aMessage.name) {
case "Contacts:Find": case "Contacts:Find":
DEBUG = false;
if (!this.assertPermission(aMessage, "contacts-read")) { if (!this.assertPermission(aMessage, "contacts-read")) {
return null; return null;
} }
@ -150,6 +151,7 @@ let ContactService = {
); );
break; break;
case "Contacts:Clear": case "Contacts:Clear":
DEBUG = true;
if (!this.assertPermission(aMessage, "contacts-write")) { if (!this.assertPermission(aMessage, "contacts-write")) {
return null; return null;
} }