Bug 1429169 - Facilitate testing of cookie-related enterprise policy by always firing the cookie-db-read event draft
authorKirk Steuber <ksteuber@mozilla.com>
Tue, 20 Mar 2018 14:56:02 -0700
changeset 775294 11eebf289689b25ca19afeba0067facf893284d3
parent 775219 0405f6006f3a3f653dd42d587c3eefe08cffa37d
child 775295 50587d42afc024ed190179ae45642b4bad2cabde
push id104688
push userksteuber@mozilla.com
push dateFri, 30 Mar 2018 20:38:45 +0000
bugs1429169
milestone61.0a1
Bug 1429169 - Facilitate testing of cookie-related enterprise policy by always firing the cookie-db-read event There seems to be no reason to conditionally fire the cookie-db-read event. Currently it is not fired if no cookies were read. There seems to be only one other consumer of this event (a test) which should work fine if the event were fired every time. This change would eliminate a particularly ugly workaround in cookie-related policy testing. MozReview-Commit-ID: FbD1cvsBZBO
netwerk/cookie/nsCookieService.cpp
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -1480,17 +1480,17 @@ nsCookieService::InitDBConn()
     }
   }
   mInitializedDBConn = true;
 
   COOKIE_LOGSTRING(LogLevel::Debug, ("InitDBConn(): mInitializedDBConn = true"));
   mEndInitDBConn = mozilla::TimeStamp::Now();
 
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
-  if (os && !mReadArray.IsEmpty()) {
+  if (os) {
     os->NotifyObservers(nullptr, "cookie-db-read", nullptr);
     mReadArray.Clear();
   }
 }
 
 nsresult
 nsCookieService::InitDBConnInternal()
 {