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

pull/28/head
Moonchild 6 months ago committed by roytam1
parent 9299c2e2ea
commit bc2aa1f05c
  1. 6
      dom/storage/DOMStorageIPC.cpp
  2. 6
      dom/storage/DOMStorageObserver.cpp

@ -213,8 +213,10 @@ DOMStorageDBChild::RecvObserve(const nsCString& aTopic,
const nsString& aOriginAttributesPattern,
const nsCString& aOriginScope)
{
DOMStorageObserver::Self()->Notify(
aTopic.get(), aOriginAttributesPattern, aOriginScope);
DOMStorageObserver* observer = DOMStorageObserver::Self();
if (observer) {
observer->Notify(aTopic.get(), aOriginAttributesPattern, aOriginScope);
}
return true;
}

@ -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.

Loading…
Cancel
Save