[DOM] Clear sinks and block further use after storage observer shutdown.

This commit is contained in:
Moonchild 2022-02-09 18:23:27 +00:00 committed by roytam1
commit bc2aa1f05c
2 changed files with 10 additions and 2 deletions

View file

@ -90,6 +90,8 @@ DOMStorageObserver::Shutdown()
if (!sSelf) {
return NS_ERROR_NOT_INITIALIZED;
}
sSelf->mSinks.Clear();
NS_RELEASE(sSelf);
return NS_OK;
@ -123,6 +125,10 @@ DOMStorageObserver::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
if (NS_WARN_IF(!sSelf)) { // Shutdown took place, so bail.
return NS_OK;
}
nsresult rv;
// Start the thread that opens the database.