Bug 619559 - Make permission manager notify observers in content processes. r=dwitte a=jst
authorJosh Matthews <josh@joshmatthews.net>
Sat, 25 Dec 2010 02:31:01 -0500
changeset 62111 3249d9d62b58e34bb6e68c8e209e40d0491c68ee
parent 62110 d21aa818cd7b469361d2415e09e9929fa55b3360
child 62112 ed15fbc0f165e3a17f581d9f6b732c28fc227cc4
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersdwitte, jst
bugs619559
milestone2.0b12pre
Bug 619559 - Make permission manager notify observers in content processes. r=dwitte a=jst
extensions/cookie/nsPermissionManager.cpp
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -222,16 +222,22 @@ nsresult
 nsPermissionManager::Init()
 {
   nsresult rv;
 
   if (!mHostTable.Init()) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
+  mObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
+  if (NS_SUCCEEDED(rv)) {
+    mObserverService->AddObserver(this, "profile-before-change", PR_TRUE);
+    mObserverService->AddObserver(this, "profile-do-change", PR_TRUE);
+  }
+
 #ifdef MOZ_IPC
   if (IsChildProcess()) {
     // Get the permissions from the parent process
     InfallibleTArray<IPC::Permission> perms;
     ChildProcess()->SendReadPermissions(&perms);
 
     for (PRUint32 i = 0; i < perms.Length(); i++) {
       const IPC::Permission &perm = perms[i];
@@ -244,22 +250,16 @@ nsPermissionManager::Init()
   }
 #endif
 
   // ignore failure here, since it's non-fatal (we can run fine without
   // persistent storage - e.g. if there's no profile).
   // XXX should we tell the user about this?
   InitDB(PR_FALSE);
 
-  mObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
-  if (NS_SUCCEEDED(rv)) {
-    mObserverService->AddObserver(this, "profile-before-change", PR_TRUE);
-    mObserverService->AddObserver(this, "profile-do-change", PR_TRUE);
-  }
-
   return NS_OK;
 }
 
 nsresult
 nsPermissionManager::InitDB(PRBool aRemoveFile)
 {
   nsCOMPtr<nsIFile> permissionsFile;
   NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(permissionsFile));