summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-02-09 18:23:27 +0000
committerMoonchild <moonchild@palemoon.org>2022-05-30 08:25:08 +0000
commit0d8cddaa733b1cb1616ecd6014e1f44de07ae8f4 (patch)
treeca0f9f323a0879d7ad8e8bd40e9f6eea344dd76b /dom
parenta595fa29a368c24978621fd90400964228b993b3 (diff)
downloaduxp-0d8cddaa733b1cb1616ecd6014e1f44de07ae8f4.tar.gz
[DOM] Clear sinks and block further use after storage observer shutdown.
Diffstat (limited to 'dom')
-rw-r--r--dom/storage/DOMStorageIPC.cpp6
-rw-r--r--dom/storage/DOMStorageObserver.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/dom/storage/DOMStorageIPC.cpp b/dom/storage/DOMStorageIPC.cpp
index 442941a7a0..1cf3463459 100644
--- a/dom/storage/DOMStorageIPC.cpp
+++ b/dom/storage/DOMStorageIPC.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;
}
diff --git a/dom/storage/DOMStorageObserver.cpp b/dom/storage/DOMStorageObserver.cpp
index 295cee4ab0..9de18738da 100644
--- a/dom/storage/DOMStorageObserver.cpp
+++ b/dom/storage/DOMStorageObserver.cpp
@@ -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.