Bug 886088 - Use a different notification topic for third-party cookies in private mode. r=ehsan
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Wed, 10 Jul 2013 10:03:04 -0400
changeset 137984 eaf3aed23ead20637a484b7f1a87c67618000f47
parent 137983 6064e0c9f89e18fc056ba3e3a28357706bd81d86
child 137985 3265d1e6ed10218dc9f406ad8eb58a66dab1c26b
push id24941
push useremorley@mozilla.com
push dateThu, 11 Jul 2013 09:11:18 +0000
treeherdermozilla-central@c89e5b9fe935 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs886088
milestone25.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 886088 - Use a different notification topic for third-party cookies in private mode. r=ehsan
netwerk/cookie/nsCookieService.cpp
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -1703,18 +1703,34 @@ nsCookieService::NotifyRejected(nsIURI *
 // notify observers that a third-party cookie was accepted/rejected
 // if the cookie issuer is unknown, it defaults to "?"
 void
 nsCookieService::NotifyThirdParty(nsIURI *aHostURI, bool aIsAccepted, nsIChannel *aChannel)
 {
   if (!mObserverService) {
     return;
   }
-  const char* topic = aIsAccepted ? "third-party-cookie-accepted"
-    : "third-party-cookie-rejected";
+
+  const char* topic;
+
+  if (mDBState != mPrivateDBState) {
+    // Regular (non-private) browsing
+    if (aIsAccepted) {
+      topic = "third-party-cookie-accepted";
+    } else {
+      topic = "third-party-cookie-rejected";
+    }
+  } else {
+    // Private browsing
+    if (aIsAccepted) {
+      topic = "private-third-party-cookie-accepted";
+    } else {
+      topic = "private-third-party-cookie-rejected";
+    }
+  }
 
   do {
     // Attempt to find the host of aChannel.
     if (!aChannel) {
       break;
     }
     nsCOMPtr<nsIURI> channelURI;
     nsresult rv = aChannel->GetURI(getter_AddRefs(channelURI));