Bug 787717 - r=bsmith
authorMounir Lamouri <mounir.lamouri@gmail.com>
Wed, 19 Sep 2012 18:25:17 +0100
changeset 107513 bf856d54786519dd3f926a073ed011ec890594c1
parent 107512 6d3db18ef4cd0c4442e642db583dbb36e1e45bff
child 107514 6125b883672b249e580995f2bc931c965a65580e
push id23490
push userMs2ger@gmail.com
push dateThu, 20 Sep 2012 11:22:06 +0000
treeherdermozilla-central@6a2d1a3556b9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmith
bugs787717
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 787717 - r=bsmith
extensions/cookie/nsPermissionManager.cpp
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -717,20 +717,16 @@ nsPermissionManager::AddInternal(nsIPrin
     }
 
   case eOperationRemoving:
     {
       PermissionEntry oldPermissionEntry = entry->GetPermissions()[index];
       id = oldPermissionEntry.mID;
       entry->GetPermissions().RemoveElementAt(index);
 
-      // If no more types are present, remove the entry
-      if (entry->GetPermissions().IsEmpty())
-        mPermissionTable.RawRemoveEntry(entry);
-
       if (aDBOperation == eWriteToDB)
         // We care only about the id here so we pass dummy values for all other
         // parameters.
         UpdateDB(op, mStmtDelete, id, EmptyCString(), EmptyCString(), 0,
                  nsIPermissionManager::EXPIRE_NEVER, 0, 0, false);
 
       if (aNotifyOperation == eNotify) {
         NotifyObserversWithPermission(host,
@@ -738,16 +734,21 @@ nsPermissionManager::AddInternal(nsIPrin
                                       entry->GetKey()->mIsInBrowserElement,
                                       mTypeArray[typeIndex],
                                       oldPermissionEntry.mPermission,
                                       oldPermissionEntry.mExpireType,
                                       oldPermissionEntry.mExpireTime,
                                       NS_LITERAL_STRING("deleted").get());
       }
 
+      // If there are no more permissions stored for that entry, clear it.
+      if (entry->GetPermissions().IsEmpty()) {
+        mPermissionTable.RawRemoveEntry(entry);
+      }
+
       break;
     }
 
   case eOperationChanging:
     {
       id = entry->GetPermissions()[index].mID;
       entry->GetPermissions()[index].mPermission = aPermission;