summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
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.