Bug 1178453 - Change logging in storage-json.js to avoid string concatenation. r=MattN
authorRiadh Chtara <rchtara@mozilla.com>
Tue, 30 Jun 2015 12:06:52 -0700
changeset 270131 7330514ef5e4d0daed0505ffc20395dced5c29ec
parent 270130 4fcf2f94a59123e88aac64c4ad515edf2137bfbc
child 270132 cabd735fde278bb755c3220fe03ef5a68be475c7
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-esr52@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1178453
milestone42.0a1
Bug 1178453 - Change logging in storage-json.js to avoid string concatenation. r=MattN
toolkit/components/passwordmgr/storage-json.js
--- a/toolkit/components/passwordmgr/storage-json.js
+++ b/toolkit/components/passwordmgr/storage-json.js
@@ -55,17 +55,17 @@ this.LoginManagerStorage_json.prototype 
 
       // Set the reference to LoginStore synchronously.
       let jsonPath = OS.Path.join(OS.Constants.Path.profileDir,
                                   "logins.json");
       this._store = new LoginStore(jsonPath);
 
       return Task.spawn(function () {
         // Load the data asynchronously.
-        this.log("Opening database at " + this._store.path);
+        this.log("Opening database at", this._store.path);
         yield this._store.load();
 
         // The import from previous versions operates the first time
         // that this built-in storage back-end is used.  This may be
         // later than expected, in case add-ons have registered an
         // alternate storage that disabled the default one.
         try {
           if (Services.prefs.getBoolPref("signon.importedFromSqlite")) {
@@ -87,17 +87,17 @@ this.LoginManagerStorage_json.prototype 
           yield loginImport.import().catch(Cu.reportError);
           this._store.saveSoon();
         }
 
         // We won't attempt import again on next startup.
         Services.prefs.setBoolPref("signon.importedFromSqlite", true);
       }.bind(this)).catch(Cu.reportError);
     } catch (e) {
-      this.log("Initialization failed: " + e);
+      this.log("Initialization failed:", e);
       throw new Error("Initialization failed");
     }
   },
 
 
   /*
    * terminate
    *
@@ -252,17 +252,17 @@ this.LoginManagerStorage_json.prototype 
    * Returns an array of nsILoginInfo.
    */
   getAllLogins : function (count) {
     let [logins, ids] = this._searchLogins({});
 
     // decrypt entries for caller.
     logins = this._decryptLogins(logins);
 
-    this.log("_getAllLogins: returning " + logins.length + " logins.");
+    this.log("_getAllLogins: returning", logins.length, "logins.");
     if (count)
       count.value = logins.length; // needed for XPCOM
     return logins;
   },
 
 
   /*
    * searchLogins
@@ -398,20 +398,20 @@ this.LoginManagerStorage_json.prototype 
         } else {
           fallbackLogins.push(login);
           fallbackIds.push(loginItem.id);
         }
       }
     }
 
     if (!foundLogins.length && fallbackLogins.length) {
-      this.log("_searchLogins: returning " + fallbackLogins.length + " fallback logins");
+      this.log("_searchLogins: returning", fallbackLogins.length, "fallback logins");
       return [fallbackLogins, fallbackIds];
     }
-    this.log("_searchLogins: returning " + foundLogins.length + " logins");
+    this.log("_searchLogins: returning", foundLogins.length, "logins");
     return [foundLogins, foundIds];
   },
 
   /*
    * removeAllLogins
    *
    * Removes all logins from storage.
    *
@@ -432,46 +432,46 @@ this.LoginManagerStorage_json.prototype 
    * getAllDisabledHosts
    *
    */
   getAllDisabledHosts : function (count) {
     this._store.ensureDataReady();
 
     let disabledHosts = this._store.data.disabledHosts.slice(0);
 
-    this.log("_getAllDisabledHosts: returning " + disabledHosts.length + " disabled hosts.");
+    this.log("_getAllDisabledHosts: returning", disabledHosts.length, "disabled hosts.");
     if (count)
       count.value = disabledHosts.length; // needed for XPCOM
     return disabledHosts;
   },
 
 
   /*
    * getLoginSavingEnabled
    *
    */
   getLoginSavingEnabled : function (hostname) {
     this._store.ensureDataReady();
 
-    this.log("Getting login saving is enabled for " + hostname);
+    this.log("Getting login saving is enabled for", hostname);
     return this._store.data.disabledHosts.indexOf(hostname) == -1;
   },
 
 
   /*
    * setLoginSavingEnabled
    *
    */
   setLoginSavingEnabled : function (hostname, enabled) {
     this._store.ensureDataReady();
 
     // Throws if there are bogus values.
     LoginHelper.checkHostnameValue(hostname);
 
-    this.log("Setting login saving enabled for " + hostname + " to " + enabled);
+    this.log("Setting login saving enabled for", hostname, "to", enabled);
     let foundIndex = this._store.data.disabledHosts.indexOf(hostname);
     if (enabled) {
       if (foundIndex != -1) {
         this._store.data.disabledHosts.splice(foundIndex, 1);
         this._store.saveSoon();
       }
     } else {
       if (foundIndex == -1) {
@@ -498,17 +498,17 @@ this.LoginManagerStorage_json.prototype 
     for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
       if (loginData[field] != '')
         matchData[field] = loginData[field];
     let [logins, ids] = this._searchLogins(matchData);
 
     // Decrypt entries found for the caller.
     logins = this._decryptLogins(logins);
 
-    this.log("_findLogins: returning " + logins.length + " logins");
+    this.log("_findLogins: returning", logins.length, "logins");
     count.value = logins.length; // needed for XPCOM
     return logins;
   },
 
 
   /*
    * countLogins
    *
@@ -521,17 +521,17 @@ this.LoginManagerStorage_json.prototype 
       httpRealm: httpRealm
     };
     let matchData = { };
     for each (let field in ["hostname", "formSubmitURL", "httpRealm"])
       if (loginData[field] != '')
         matchData[field] = loginData[field];
     let [logins, ids] = this._searchLogins(matchData);
 
-    this.log("_countLogins: counted logins: " + logins.length);
+    this.log("_countLogins: counted logins:", logins.length);
     return logins.length;
   },
 
 
   /*
    * uiBusy
    */
   get uiBusy() {