mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 608422 - cookies.sqlite-wal takes too much space for Fennec. Add test. r=mfinkle, a=beta2+
This commit is contained in:
parent
e66e086b97
commit
4df35d9668
@ -477,19 +477,26 @@ CookieDatabaseConnection.prototype =
|
||||
}
|
||||
}
|
||||
|
||||
// Count the cookies from 'host' in a database.
|
||||
// Count the cookies from 'host' in a database. If 'host' is null, count all
|
||||
// cookies.
|
||||
function do_count_cookies_in_db(profile, host)
|
||||
{
|
||||
let file = profile.clone();
|
||||
file.append("cookies.sqlite");
|
||||
let connection = Services.storage.openDatabase(file);
|
||||
|
||||
let select = connection.createStatement(
|
||||
"SELECT COUNT(1) FROM moz_cookies WHERE host = :host");
|
||||
select.bindByName("host", host);
|
||||
let select = null;
|
||||
if (host) {
|
||||
select = connection.createStatement(
|
||||
"SELECT COUNT(1) FROM moz_cookies WHERE host = :host");
|
||||
select.bindByName("host", host);
|
||||
} else {
|
||||
select = connection.createStatement(
|
||||
"SELECT COUNT(1) FROM moz_cookies");
|
||||
}
|
||||
|
||||
select.executeStep();
|
||||
let result = select.getInt32(0);
|
||||
|
||||
select.reset();
|
||||
select.finalize();
|
||||
connection.close();
|
||||
|
@ -29,6 +29,22 @@ function do_run_test() {
|
||||
|
||||
do_check_eq(do_count_cookies(), 3000);
|
||||
|
||||
// Wait until all 3000 cookies have been written out to the database.
|
||||
let db = new CookieDatabaseConnection(profile, 4);
|
||||
while (do_count_cookies_in_db(profile) < 3000) {
|
||||
do_execute_soon(function() {
|
||||
do_run_generator(test_generator);
|
||||
});
|
||||
yield;
|
||||
}
|
||||
|
||||
// Check the WAL file size. We set it to 16 pages of 32k, which means it
|
||||
// should be around 500k.
|
||||
let file = db.db.databaseFile;
|
||||
do_check_true(file.exists());
|
||||
do_check_true(file.fileSize < 1e6);
|
||||
db.close();
|
||||
|
||||
// fake a profile change
|
||||
do_close_profile(test_generator);
|
||||
yield;
|
||||
|
Loading…
Reference in New Issue
Block a user