mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1919555 - LSNG: Error out LSObject::EnsureDatabase if preparation has been invalidated; r=dom-storage-reviewers,nika,asuth
Differential Revision: https://phabricator.services.mozilla.com/D222425
This commit is contained in:
parent
deda722602
commit
0fb8d3ed72
@ -7539,6 +7539,7 @@ void PrepareDatastoreOp::GetResponse(LSRequestResponse& aResponse) {
|
||||
LSRequestPrepareDatastoreResponse prepareDatastoreResponse;
|
||||
prepareDatastoreResponse.databaseChildEndpoint() =
|
||||
std::move(childEndpoint);
|
||||
prepareDatastoreResponse.invalidated() = mInvalidated;
|
||||
|
||||
aResponse = std::move(prepareDatastoreResponse);
|
||||
}
|
||||
|
@ -946,6 +946,11 @@ nsresult LSObject::EnsureDatabase() {
|
||||
glean::ls_preparelsdatabase::processing_time.StopAndAccumulate(
|
||||
std::move(latencyTimerId));
|
||||
|
||||
if (prepareDatastoreResponse.invalidated()) {
|
||||
database->RequestAllowToClose();
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
mDatabase = std::move(database);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -18,6 +18,7 @@ struct LSRequestPreloadDatastoreResponse
|
||||
struct LSRequestPrepareDatastoreResponse
|
||||
{
|
||||
Endpoint<PBackgroundLSDatabaseChild> databaseChildEndpoint;
|
||||
bool invalidated;
|
||||
};
|
||||
|
||||
struct LSRequestPrepareObserverResponse
|
||||
|
@ -16,6 +16,11 @@ add_task(async function testSteps() {
|
||||
|
||||
const storage = LocalStorageUtils.createStorage(principal);
|
||||
|
||||
// XXX This should throw!
|
||||
storage.getItem("foo");
|
||||
try {
|
||||
storage.getItem("foo");
|
||||
ok(false, "Should have thrown");
|
||||
} catch (e) {
|
||||
ok(true, "Should have thrown");
|
||||
Assert.strictEqual(e.result, Cr.NS_ERROR_ABORT, "Threw right result code");
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user