Bug 1098220 - Only print exception message in SettingsService in exceptional situations; r=gerard-majax
authorKyle Machulis <kyle@nonpolynomial.com>
Tue, 23 Dec 2014 11:11:20 -0800
changeset 221162 0529b5dca28e29c453f6747396c026f66efa59dd
parent 221161 29f43ccdef2bfda55aa7e3a16c5b44a7ff0e7c79
child 221163 1fe76ae247cd593adba1053f213f6b939be6be42
push id28011
push userkwierso@gmail.com
push dateWed, 24 Dec 2014 00:36:52 +0000
treeherdermozilla-central@865d06511e99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerard-majax
bugs1098220
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1098220 - Only print exception message in SettingsService in exceptional situations; r=gerard-majax
dom/settings/SettingsService.js
--- a/dom/settings/SettingsService.js
+++ b/dom/settings/SettingsService.js
@@ -160,17 +160,17 @@ SettingsServiceLock.prototype = {
         if (DEBUG) debug("Wrong message: " + aMessage.name);
     }
     this.runOrFinalizeQueries();
   },
 
   get: function get(aName, aCallback) {
     if (VERBOSE) debug("get (" + this._id + "): " + aName);
     if (!this._open) {
-      dump("Settings lock not open!\n");
+      if (DEBUG) debug("Settings lock not open!\n");
       throw Components.results.NS_ERROR_ABORT;
     }
     let reqID = uuidgen.generateUUID().toString();
     this._requests[reqID] = makeSettingsServiceRequest(aCallback, aName);
     cpmm.sendAsyncMessage("Settings:Get", {requestID: reqID,
                                            lockID: this._id,
                                            name: aName},
                                            undefined,
@@ -190,43 +190,43 @@ SettingsServiceLock.prototype = {
                                            lockID: this._id,
                                            settings: settings},
                                            undefined,
                                            Services.scriptSecurityManager.getSystemPrincipal());
   },
 
   callHandle: function callHandle(aCallback, aName, aValue) {
     try {
-      aCallback ? aCallback.handle(aName, aValue) : null;
+        aCallback && aCallback.handle ? aCallback.handle(aName, aValue) : null;
     } catch (e) {
-      dump("settings 'handle' callback threw an exception, dropping: " + e + "\n");
+      if (DEBUG) debug("settings 'handle' callback threw an exception, dropping: " + e + "\n");
     }
   },
 
   callAbort: function callAbort(aCallback, aMessage) {
     try {
-      aCallback ? aCallback.handleAbort(aMessage) : null;
+      aCallback && aCallback.handleAbort ? aCallback.handleAbort(aMessage) : null;
     } catch (e) {
-      dump("settings 'abort' callback threw an exception, dropping: " + e + "\n");
+      if (DEBUG) debug("settings 'abort' callback threw an exception, dropping: " + e + "\n");
     }
   },
 
   callError: function callError(aCallback, aMessage) {
     try {
-      aCallback ? aCallback.handleError(aMessage) : null;
+      aCallback && aCallback.handleError ? aCallback.handleError(aMessage) : null;
     } catch (e) {
-      dump("settings 'error' callback threw an exception, dropping: " + e + "\n");
+      if (DEBUG) debug("settings 'error' callback threw an exception, dropping: " + e + "\n");
     }
   },
 
   callTransactionHandle: function callTransactionHandle() {
     try {
-      this._transactionCallback ? this._transactionCallback.handle() : null;
+      this._transactionCallback && this._transactionCallback.handle ? this._transactionCallback.handle() : null;
     } catch (e) {
-      dump("settings 'Transaction handle' callback threw an exception, dropping: " + e + "\n");
+      if (DEBUG) debug("settings 'Transaction handle' callback threw an exception, dropping: " + e + "\n");
     }
   },
 
   classID : SETTINGSSERVICELOCK_CID,
   QueryInterface : XPCOMUtils.generateQI([nsISettingsServiceLock])
 };
 
 const SETTINGSSERVICE_CID        = Components.ID("{f656f0c0-f776-11e1-a21f-0800200c9a66}");