mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 01:44:42 +00:00
Bug 1919788 - LSNG: Add a new testing only notification for request finalization; r=dom-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D222458
This commit is contained in:
parent
d4657c7ef2
commit
3c753be15b
@ -6372,6 +6372,8 @@ nsresult LSRequestBase::SendReadyMessageInternal() {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
localstorage::NotifyRequestFinalizationStarted();
|
||||
|
||||
mState = State::WaitingForFinish;
|
||||
|
||||
mWaitingForFinish = true;
|
||||
|
@ -19,4 +19,13 @@ void NotifyDatabaseWorkStarted() {
|
||||
quota::NotifyObserversOnMainThread("LocalStorage::DatabaseWorkStarted");
|
||||
}
|
||||
|
||||
void NotifyRequestFinalizationStarted() {
|
||||
if (!StaticPrefs::dom_storage_testing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
quota::NotifyObserversOnMainThread(
|
||||
"LocalStorage::RequestFinalizationStarted");
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom::localstorage
|
||||
|
@ -11,6 +11,8 @@ namespace mozilla::dom::localstorage {
|
||||
|
||||
void NotifyDatabaseWorkStarted();
|
||||
|
||||
void NotifyRequestFinalizationStarted();
|
||||
|
||||
} // namespace mozilla::dom::localstorage
|
||||
|
||||
#endif // DOM_LOCALSTORAGE_NOTIFYUTILS_H_
|
||||
|
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
const { PrincipalUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/dom/quota/test/modules/PrincipalUtils.sys.mjs"
|
||||
);
|
||||
const { TestUtils } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TestUtils.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function testSteps() {
|
||||
const principal = PrincipalUtils.createPrincipal("https://example.com");
|
||||
|
||||
info("Starting database opening");
|
||||
|
||||
const openPromise = Services.domStorageManager.preload(principal);
|
||||
|
||||
info("Waiting for request finalization to start");
|
||||
|
||||
await TestUtils.topicObserved("LocalStorage::RequestFinalizationStarted");
|
||||
|
||||
info("Waiting for database to finish opening");
|
||||
|
||||
await openPromise;
|
||||
});
|
@ -83,6 +83,8 @@ support-files = ["migration_emptyValue_profile.zip",]
|
||||
|
||||
["test_preloading.js"]
|
||||
|
||||
["test_requestFinalizationStarted.js"]
|
||||
|
||||
["test_schema3upgrade.js"]
|
||||
|
||||
["test_schema4upgrade.js"]
|
||||
|
Loading…
Reference in New Issue
Block a user