/**
* Tests that failing to open a SQLite connection doesn't leak the SQLite
* structure. sqlite3_close() must always be invoked, even in case of failures.
* This will only fail on asan builds and requires shutdown leaks detection.
*/
add_task(async function test_initWidget() {
let file = Services.dirsvc.get("ProfDS", Ci.nsIFile);
file.append("nonexisting.sqlite");
try {
file.remove(true);
} catch (ex) { }
await Assert.rejects(
new Promise((resolve, reject) => {
Services.storage.openAsyncDatabase(
file,
Ci.mozIStorageService.OPEN_READONLY,
Ci.mozIStorageService.CONNECTION_DEFAULT,
function (status, db) {
if (Components.isSuccessCode(status)) {
resolve(db.QueryInterface(Ci.mozIStorageAsyncConnection));
} else {
reject(new Components.Exception("Error opening database", status));
}
}
);
}),
/NS_ERROR_FILE_ACCESS_DENIED/, "Should fail to open non existing database"
);
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.