Bug 452899 - Don't explicitly create the statement wrapper - storage does it for us; r=(dolske + sdwilsh)
authorPaul O'Shannessy <paul@oshannessy.com>
Sat, 21 Mar 2009 00:38:43 +0100
changeset 26434 10e8371749f9d4e7f1444c313db6744333453c84
parent 26433 35c8ac2aac227473785dc37366b441ad4c9634dc
child 26435 38bf155ba088d5a70c9d017d871c4073debede03
child 26439 11d92035b807de4ffe510a14f9226de1c4743433
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs452899
milestone1.9.2a1pre
Bug 452899 - Don't explicitly create the statement wrapper - storage does it for us; r=(dolske + sdwilsh)
toolkit/components/passwordmgr/src/storage-mozStorage.js
--- a/toolkit/components/passwordmgr/src/storage-mozStorage.js
+++ b/toolkit/components/passwordmgr/src/storage-mozStorage.js
@@ -1110,22 +1110,17 @@ LoginManagerStorage_mozStorage.prototype
      * Returns the wrapped statement for execution.  Will use memoization
      * so that statements can be reused.
      */
     _dbCreateStatement : function (query, params) {
         let wrappedStmt = this._dbStmts[query];
         // Memoize the statements
         if (!wrappedStmt) {
             this.log("Creating new statement for query: " + query);
-            let stmt = this._dbConnection.createStatement(query);
-
-            wrappedStmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
-                          createInstance(Ci.mozIStorageStatementWrapper);
-            wrappedStmt.initialize(stmt);
-            this._dbStmts[query] = wrappedStmt;
+            this._dbStmts[query] = this._dbConnection.createStatement(query);
         }
         // Replace parameters, must be done 1 at a time
         if (params)
             for (let i in params)
                 wrappedStmt.params[i] = params[i];
         return wrappedStmt;
     },
 
@@ -1354,17 +1349,17 @@ LoginManagerStorage_mozStorage.prototype
         // Create backup file
         if (backup) {
             let backupFile = this._signonsFile.leafName + ".corrupt";
             this._storageService.backupDatabaseFile(this._signonsFile, backupFile);
         }
 
         // Finalize all statements to free memory, avoid errors later
         for (let i = 0; i < this._dbStmts.length; i++)
-            this._dbStmts[i].statement.finalize();
+            this._dbStmts[i].finalize();
         this._dbStmts = [];
 
         // Close the connection, ignore 'already closed' error
         try { this._dbConnection.close() } catch(e) {}
         this._signonsFile.remove(false);
     }
 
 }; // end of nsLoginManagerStorage_mozStorage implementation