Backed out changeset 08185bc7ab8d (bug 885979)

This commit is contained in:
Reuben Morais 2013-07-01 23:14:32 -07:00
parent f74a87496f
commit cedd3409f5
3 changed files with 5 additions and 58 deletions

View File

@ -4,12 +4,7 @@
"use strict";
let DEBUG = false;
function updateDebug(aResult) {
DEBUG = !!aResult;
}
const DEBUG = false;
function debug(s) { dump("-*- ContactManager: " + s + "\n"); }
const Cc = Components.classes;
@ -32,10 +27,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsIMessageSender");
XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
"@mozilla.org/settingsService;1",
"nsISettingsService");
const CONTACTS_SENDMORE_MINIMUM = 5;
function stringOrBust(aObj) {
@ -928,16 +919,6 @@ ContactManager.prototype = {
"PermissionPromptHelper:AskPermission:OK",
"Contacts:GetAll:Next", "Contacts:Revision",
"Contacts:Count"]);
let lock = gSettingsService.createLock();
lock.get("dom.mozContacts.debugging.enabled", {
handle: function(aName, aResult) {
updateDebug(aResult);
},
handleError: function(aErrorMessage) {
if (DEBUG) debug("Error reading dom.mozContacts.debugging.enabled setting: " + aErrorMessage);
}
});
},
// Called from DOMRequestIpcHelper

View File

@ -6,7 +6,7 @@
this.EXPORTED_SYMBOLS = ['ContactDB'];
let DEBUG = false;
const DEBUG = false;
function debug(s) { dump("-*- ContactDB component: " + s + "\n"); }
const Cu = Components.utils;
@ -952,10 +952,6 @@ ContactDB.prototype = {
this.substringMatching = aDigits;
},
enableDebugging: function(aEnable) {
DEBUG = aEnable;
},
init: function init(aGlobal) {
this.initDBHelper(DB_NAME, DB_VERSION, [STORE_NAME, SAVED_GETALL_STORE_NAME, REVISION_STORE], aGlobal);
}

View File

@ -4,7 +4,7 @@
"use strict";
let DEBUG = false;
const DEBUG = false;
function debug(s) { dump("-*- Fallback ContactService component: " + s + "\n"); }
const Cu = Components.utils;
@ -22,10 +22,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
"@mozilla.org/parentprocessmessagemanager;1",
"nsIMessageListenerManager");
XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
"@mozilla.org/settingsService;1",
"nsISettingsService");
let myGlobal = this;
let ContactService = {
@ -56,33 +52,17 @@ let ContactService = {
}
}
let lock = gSettingsService.createLock();
lock.get("dom.mozContacts.debugging.enabled", {
handle: function(aName, aResult) {
updateDebug(aResult);
},
handleError: function(aErrorMessage) {
if (DEBUG) debug("Error reading dom.mozContacts.debugging.enabled setting: " + aErrorMessage);
}
});
Services.obs.addObserver(this, "profile-before-change", false);
Services.obs.addObserver(this, "mozsettings-changed", false);
Services.prefs.addObserver("dom.phonenumber.substringmatching", this, false);
},
enableDebugging: function(aResult) {
this._db.enableDebugging(aResult);
},
observe: function(aSubject, aTopic, aData) {
if (aTopic === "profile-before-change") {
if (aTopic === 'profile-before-change') {
myGlobal = null;
this._messages.forEach(function(msgName) {
ppmm.removeMessageListener(msgName, this);
}.bind(this));
Services.obs.removeObserver(this, "profile-before-change");
Services.obs.removeObserver(this, "mozsettings-changed");
Services.prefs.removeObserver("dom.phonenumber.substringmatching", this);
ppmm = null;
this._messages = null;
@ -91,7 +71,7 @@ let ContactService = {
this._db = null;
this._children = null;
this._cursors = null;
} else if (aTopic === "nsPref:changed" && aData.contains("dom.phonenumber.substringmatching")) {
} else if (aTopic === 'nsPref:changed' && aData.contains("dom.phonenumber.substringmatching")) {
// We don't fully support changing substringMatching during runtime. This is mostly for testing.
let countryName = PhoneNumberUtils.getCountryName();
if (Services.prefs.getPrefType("dom.phonenumber.substringmatching." + countryName) == Ci.nsIPrefBranch.PREF_INT) {
@ -100,11 +80,6 @@ let ContactService = {
this._db.enableSubstringMatching(val);
}
}
} else if (aTopic === "mozsettings-changed") {
let data = JSON.parse(aData);
if (data.key === "dom.mozContacts.debugging.enabled") {
updateDebug(data.value);
}
}
},
@ -276,8 +251,3 @@ let ContactService = {
}
ContactService.init();
function updateDebug(aResult) {
DEBUG = !!aResult;
ContactService.enableDebugging(DEBUG);
}