mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-04 18:29:29 +02:00
For how much it may sound strange, sometimes all the reads just happen before the write, so they won't see the table. Also fixes a wrong check on previousException. Differential Revision: https://phabricator.services.mozilla.com/D167478
29 lines
764 B
JavaScript
29 lines
764 B
JavaScript
"use strict";
|
|
|
|
let tmpFile = FileUtils.getDir("TmpD", [], true);
|
|
let dbConn;
|
|
|
|
add_task(async function setup() {
|
|
tmpFile.append("TestDB");
|
|
dbConn = await Sqlite.openConnection({ path: tmpFile.path });
|
|
|
|
registerCleanupFunction(async () => {
|
|
await dbConn.close();
|
|
await IOUtils.remove(tmpFile.path);
|
|
});
|
|
});
|
|
|
|
add_task(async function testgetRowsFromDBWithoutLocksRetries() {
|
|
let deferred = PromiseUtils.defer();
|
|
let promise = MigrationUtils.getRowsFromDBWithoutLocks(
|
|
tmpFile.path,
|
|
"Temp DB",
|
|
"SELECT * FROM moz_temp_table",
|
|
deferred.promise
|
|
);
|
|
await new Promise(resolve => do_timeout(50, resolve));
|
|
dbConn
|
|
.execute("CREATE TABLE moz_temp_table (id INTEGER PRIMARY KEY)")
|
|
.then(deferred.resolve);
|
|
await promise;
|
|
});
|