зеркало из https://github.com/mozilla/gecko-dev.git
Bug 518608 - Download Manager Storage usage changes: Don't create statement wrapper & don't use step(). r=sdwilsh
--HG-- extra : rebase_source : 201aab379506521c18620782ea79a7f9cd0e1597
This commit is contained in:
Родитель
2b83a9036c
Коммит
b5604369c5
|
@ -105,7 +105,7 @@ function check_existance(aIDs, aExpected)
|
|||
let checkFunc = aExpected ? do_check_true : do_check_false;
|
||||
for (let i = 0; i < aIDs.length; i++) {
|
||||
stmt.params.id = aIDs[i];
|
||||
checkFunc(stmt.step());
|
||||
checkFunc(stmt.executeStep());
|
||||
stmt.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,21 +127,18 @@ function test()
|
|||
|
||||
// First, we populate the database with some fake data
|
||||
db.executeSimpleSQL("DELETE FROM moz_downloads");
|
||||
var rawStmt = db.createStatement(
|
||||
var stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
|
||||
"state, currBytes, maxBytes, preferredAction, autoResume) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
|
||||
":currBytes, :maxBytes, :preferredAction, :autoResume)");
|
||||
var stmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
|
||||
createInstance(Ci.mozIStorageStatementWrapper)
|
||||
stmt.initialize(rawStmt);
|
||||
for each (var dl in DownloadData) {
|
||||
for (var prop in dl)
|
||||
stmt.params[prop] = dl[prop];
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
stmt.statement.finalize();
|
||||
stmt.finalize();
|
||||
|
||||
// See if the DM is already open, and if it is, close it!
|
||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||
|
|
|
@ -193,21 +193,18 @@ function test()
|
|||
|
||||
// First, we populate the database with some fake data
|
||||
db.executeSimpleSQL("DELETE FROM moz_downloads");
|
||||
var rawStmt = db.createStatement(
|
||||
var stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
|
||||
"state, currBytes, maxBytes, preferredAction, autoResume) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
|
||||
":currBytes, :maxBytes, :preferredAction, :autoResume)");
|
||||
var stmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
|
||||
createInstance(Ci.mozIStorageStatementWrapper)
|
||||
stmt.initialize(rawStmt);
|
||||
for each (var dl in DownloadData) {
|
||||
for (var prop in dl)
|
||||
stmt.params[prop] = dl[prop];
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
stmt.statement.finalize();
|
||||
stmt.finalize();
|
||||
|
||||
// See if the DM is already open, and if it is, close it!
|
||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||
|
|
|
@ -92,19 +92,16 @@ function test()
|
|||
// Empty any old downloads
|
||||
db.executeSimpleSQL("DELETE FROM moz_downloads");
|
||||
|
||||
let rawStmt = db.createStatement(
|
||||
let stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
|
||||
"state, currBytes, maxBytes, preferredAction, autoResume) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
|
||||
":currBytes, :maxBytes, :preferredAction, :autoResume)");
|
||||
let stmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
|
||||
createInstance(Ci.mozIStorageStatementWrapper)
|
||||
stmt.initialize(rawStmt);
|
||||
for (let prop in DownloadData)
|
||||
stmt.params[prop] = DownloadData[prop];
|
||||
|
||||
stmt.execute();
|
||||
stmt.statement.finalize();
|
||||
stmt.finalize();
|
||||
|
||||
// Close the UI if necessary
|
||||
let wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||
|
|
|
@ -132,21 +132,18 @@ function test()
|
|||
|
||||
// First, we populate the database with some fake data
|
||||
db.executeSimpleSQL("DELETE FROM moz_downloads");
|
||||
var rawStmt = db.createStatement(
|
||||
var stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
|
||||
"state, currBytes, maxBytes, preferredAction, autoResume) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
|
||||
":currBytes, :maxBytes, :preferredAction, :autoResume)");
|
||||
var stmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
|
||||
createInstance(Ci.mozIStorageStatementWrapper)
|
||||
stmt.initialize(rawStmt);
|
||||
for each (var dl in DownloadData) {
|
||||
for (var prop in dl)
|
||||
stmt.params[prop] = dl[prop];
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
stmt.statement.finalize();
|
||||
stmt.finalize();
|
||||
|
||||
// See if the DM is already open, and if it is, close it!
|
||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||
|
|
|
@ -97,21 +97,18 @@ function test()
|
|||
|
||||
// First, we populate the database with some fake data
|
||||
db.executeSimpleSQL("DELETE FROM moz_downloads");
|
||||
var rawStmt = db.createStatement(
|
||||
var stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
|
||||
"state, currBytes, maxBytes, preferredAction, autoResume, entityID) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
|
||||
":currBytes, :maxBytes, :preferredAction, :autoResume, :entityID)");
|
||||
var stmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
|
||||
createInstance(Ci.mozIStorageStatementWrapper)
|
||||
stmt.initialize(rawStmt);
|
||||
for each (var dl in DownloadData) {
|
||||
for (var prop in dl)
|
||||
stmt.params[prop] = dl[prop];
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
stmt.statement.finalize();
|
||||
stmt.finalize();
|
||||
|
||||
// See if the DM is already open, and if it is, close it!
|
||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||
|
|
|
@ -87,21 +87,18 @@ function test()
|
|||
|
||||
// First, we populate the database with some fake data
|
||||
db.executeSimpleSQL("DELETE FROM moz_downloads");
|
||||
var rawStmt = db.createStatement(
|
||||
var stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
|
||||
"state, currBytes, maxBytes, preferredAction, autoResume) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
|
||||
":currBytes, :maxBytes, :preferredAction, :autoResume)");
|
||||
var stmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
|
||||
createInstance(Ci.mozIStorageStatementWrapper)
|
||||
stmt.initialize(rawStmt);
|
||||
for each (var dl in DownloadData) {
|
||||
for (var prop in dl)
|
||||
stmt.params[prop] = dl[prop];
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
stmt.statement.finalize();
|
||||
stmt.finalize();
|
||||
|
||||
// See if the DM is already open, and if it is, close it!
|
||||
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||
|
|
|
@ -127,21 +127,18 @@ function populateDM(DownloadData)
|
|||
getService(Ci.nsIDownloadManager);
|
||||
let db = dm.DBConnection;
|
||||
|
||||
let rawStmt = db.createStatement(
|
||||
let stmt = db.createStatement(
|
||||
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
|
||||
"state, currBytes, maxBytes, preferredAction, autoResume) " +
|
||||
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
|
||||
":currBytes, :maxBytes, :preferredAction, :autoResume)");
|
||||
let stmt = Cc["@mozilla.org/storage/statement-wrapper;1"].
|
||||
createInstance(Ci.mozIStorageStatementWrapper)
|
||||
stmt.initialize(rawStmt);
|
||||
for each (let dl in DownloadData) {
|
||||
for (let prop in dl)
|
||||
stmt.params[prop] = dl[prop];
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
stmt.statement.finalize();
|
||||
stmt.finalize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче