Bug 769288 - Part 3: Clear all temporary cert overrides upon leaving private browsing. r=bsmith
☠☠ backed out by 553a3bcf1fe7 ☠ ☠
authorJosh Matthews <josh@joshmatthews.net>
Thu, 06 Dec 2012 22:05:34 -0500
changeset 115622 e10c24f10bd21d8887cfc96f521107ffb02ac783
parent 115621 7b0fdedb4fa900e366f0b017dfba3864236ce8db
child 115623 e75cd1e1fca33d040197fd6c752703bb88651456
push idunknown
push userunknown
push dateunknown
reviewersbsmith
bugs769288
milestone20.0a1
Bug 769288 - Part 3: Clear all temporary cert overrides upon leaving private browsing. r=bsmith
security/manager/ssl/src/nsCertOverrideService.cpp
--- a/security/manager/ssl/src/nsCertOverrideService.cpp
+++ b/security/manager/ssl/src/nsCertOverrideService.cpp
@@ -119,16 +119,17 @@ nsCertOverrideService::Init()
       mozilla::services::GetObserverService();
 
   // If we cannot add ourselves as a profile change observer, then we will not
   // attempt to read/write any settings file. Otherwise, we would end up
   // reading/writing the wrong settings file after a profile change.
   if (observerService) {
     observerService->AddObserver(this, "profile-before-change", true);
     observerService->AddObserver(this, "profile-do-change", true);
+    observerService->AddObserver(this, "last-pb-context-exited", true);
     // simulate a profile change so we read the current profile's settings file
     Observe(nullptr, "profile-do-change", nullptr);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -163,16 +164,20 @@ nsCertOverrideService::Observe(nsISuppor
     nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mSettingsFile));
     if (NS_SUCCEEDED(rv)) {
       mSettingsFile->AppendNative(NS_LITERAL_CSTRING(kCertOverrideFileName));
     } else {
       mSettingsFile = nullptr;
     }
     Read();
 
+  } else if (!nsCRT::strcmp(aTopic, "last-pb-context-exited")) {
+    ClearValidityOverride(
+        NS_LITERAL_CSTRING("all:temporary-certificates"),
+        0);
   }
 
   return NS_OK;
 }
 
 void
 nsCertOverrideService::RemoveAllFromMemory()
 {