(Merge for "Backed out changeset: c8eb8a8f42d9")
authorSerge Gautherie <sgautherie.bz@free.fr>
Thu, 04 Dec 2008 19:32:03 +0100
changeset 22351 0eacac1fe6b940b029639bcd34dd2808885ba8e8
parent 22349 c764915ebd2ee7587a80d79f5a76ddc67d40627f (current diff)
parent 22350 3ffab81215a09a90dce2e2ca08a8f407751d0dbe (diff)
child 22352 f90c51ed3cd2da317c57210186527113293110c5
push idunknown
push userunknown
push dateunknown
milestone1.9.2a1pre
(Merge for "Backed out changeset: c8eb8a8f42d9")
--- a/toolkit/components/passwordmgr/src/storage-mozStorage.js
+++ b/toolkit/components/passwordmgr/src/storage-mozStorage.js
@@ -949,17 +949,22 @@ LoginManagerStorage_mozStorage.prototype
      * Creates a statement, wraps it, and then does parameter replacement
      * Returns the wrapped statement for execution.  Will use memoization
      * so that statements can be reused.
      */
     _dbCreateStatement : function (query, params) {
         // Memoize the statements
         if (!this._dbStmts[query]) {
             this.log("Creating new statement for query: " + query);
-            this._dbStmts[query] = this._dbConnection.createStatement(query);
+            let stmt = this._dbConnection.createStatement(query);
+
+            let wrappedStmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
+                              createInstance(Ci.mozIStorageStatementWrapper);
+            wrappedStmt.initialize(stmt);
+            this._dbStmts[query] = wrappedStmt;
         }
         // Replace parameters, must be done 1 at a time
         if (params)
             for (let i in params)
                 this._dbStmts[query].params[i] = params[i];
         return this._dbStmts[query];
     },
 
@@ -1072,17 +1077,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].finalize();
+            this._dbStmts[i].statement.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