Bug 1140389 - Fix test_SQLiteStore.js and test_ReadingList.js failures on Windows due to NS_ERROR_FILE_IS_LOCKED. r=Unfocused

This commit is contained in:
Drew Willcoxon 2015-03-11 12:51:00 -04:00
parent 4ddb03e24f
commit ab233cfde8
4 changed files with 20 additions and 9 deletions

View File

@ -126,11 +126,16 @@ this.SQLiteStore.prototype = {
/**
* Call this when you're done with the store. Don't use it afterward.
*/
destroy: Task.async(function* () {
let conn = yield this._connectionPromise;
yield conn.close();
this._connectionPromise = Promise.reject("Store destroyed");
}),
destroy() {
if (!this._destroyPromise) {
this._destroyPromise = Task.spawn(function* () {
let conn = yield this._connectionPromise;
yield conn.close();
this._connectionPromise = Promise.reject("Store destroyed");
}.bind(this));
}
return this._destroyPromise;
},
/**
* Creates the database connection if it hasn't been created already.

View File

@ -21,7 +21,9 @@ add_task(function* prepare() {
gList = ReadingList;
Assert.ok(gList);
gDBFile.append(gList._store.pathRelativeToProfileDir);
do_register_cleanup(() => {
do_register_cleanup(function* () {
// Wait for the list's store to close its connection to the database.
yield gList.destroy();
if (gDBFile.exists()) {
gDBFile.remove(true);
}

View File

@ -23,7 +23,11 @@ add_task(function* prepare() {
}
}
removeDB();
do_register_cleanup(removeDB);
do_register_cleanup(function* () {
// Wait for the store to close its connection to the database.
yield gStore.destroy();
removeDB();
});
gStore = new SQLiteStore(dbFile.path);

View File

@ -2,6 +2,6 @@
head = head.js
firefox-appdir = browser
;[test_ReadingList.js]
[test_ReadingList.js]
[test_scheduler.js]
;[test_SQLiteStore.js]
[test_SQLiteStore.js]