Bug 621366 - Content process nsDOMStorageManager observes notifications needlessly; r=honzab a=jst
authorJosh Matthews <josh@joshmatthews.net>
Sat, 25 Dec 2010 02:31:01 -0500
changeset 61792 4eb9e146d2304d06e2df85dc01d0b0eb24bb2495
parent 61791 5947cd7a6ca2af3febf77c63f8cd1d68ffa0eca8
child 61793 af87fa0a3052d6dd3ae3f5ce3d2f7b5ee64af3ef
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewershonzab, jst
bugs621366
milestone2.0b12pre
Bug 621366 - Content process nsDOMStorageManager observes notifications needlessly; r=honzab a=jst
dom/src/storage/nsDOMStorage.cpp
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -266,16 +266,22 @@ nsDOMStorageManager::Initialize()
   if (!gStorageManager->mStorages.Init()) {
     delete gStorageManager;
     gStorageManager = nsnull;
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(gStorageManager);
 
+#ifdef MOZ_IPC
+  // No observers needed in non-chrome
+  if (XRE_GetProcessType() != GeckoProcessType_Default)
+    return NS_OK;
+#endif
+
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (!os)
     return NS_OK;
 
   os->AddObserver(gStorageManager, "cookie-changed", PR_FALSE);
   os->AddObserver(gStorageManager, "offline-app-removed", PR_FALSE);
   os->AddObserver(gStorageManager, NS_PRIVATE_BROWSING_SWITCH_TOPIC, PR_FALSE);
   os->AddObserver(gStorageManager, "profile-after-change", PR_FALSE);