bug 1451150 - make TRRService wait for the correct CP event r=valentin
authorDaniel Stenberg <daniel@haxx.se>
Wed, 04 Apr 2018 00:16:55 +0200
changeset 411678 d77aeb32f93d043ded38043e3ab49ec169ff44f6
parent 411677 0a5788b2cbb81f8ecfc4148a5114edfd7c197652
child 411679 b318d775a2c8ec2e612c62b07e1c78718d3645de
push id101729
push usercsabou@mozilla.com
push dateWed, 04 Apr 2018 18:07:35 +0000
treeherdermozilla-inbound@3c240f56a113 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1451150
milestone61.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 1451150 - make TRRService wait for the correct CP event r=valentin MozReview-Commit-ID: LwBjw7EKBhR
netwerk/dns/TRRService.cpp
--- a/netwerk/dns/TRRService.cpp
+++ b/netwerk/dns/TRRService.cpp
@@ -281,36 +281,41 @@ TRRService::Observe(nsISupports *aSubjec
 
   } else if (!strcmp(aTopic, kOpenCaptivePortalLoginEvent)) {
     // We are in a captive portal
     LOG(("TRRservice in captive portal\n"));
     mCaptiveIsPassed = false;
   } else if (!strcmp(aTopic, NS_CAPTIVE_PORTAL_CONNECTIVITY)) {
     nsAutoCString data = NS_ConvertUTF16toUTF8(aData);
     LOG(("TRRservice captive portal was %s\n", data.get()));
-    if (!mTRRBLStorage) {
-      mTRRBLStorage = DataStorage::Get(DataStorageClass::TRRBlacklist);
-      if (mTRRBLStorage) {
-        bool storageWillPersist = true;
-        if (NS_FAILED(mTRRBLStorage->Init(storageWillPersist))) {
-          mTRRBLStorage = nullptr;
-        }
-        if (mClearTRRBLStorage) {
-          if (mTRRBLStorage) {
-            mTRRBLStorage->Clear();
+    if (data.Equals("clear")) {
+      if (!mTRRBLStorage) {
+        mTRRBLStorage = DataStorage::Get(DataStorageClass::TRRBlacklist);
+        if (mTRRBLStorage) {
+          bool storageWillPersist = true;
+          if (NS_FAILED(mTRRBLStorage->Init(storageWillPersist))) {
+            mTRRBLStorage = nullptr;
           }
-          mClearTRRBLStorage = false;
+          if (mClearTRRBLStorage) {
+            if (mTRRBLStorage) {
+              mTRRBLStorage->Clear();
+            }
+            mClearTRRBLStorage = false;
+          }
         }
       }
+      if (mConfirmationState != CONFIRM_OK) {
+        mConfirmationState = CONFIRM_TRYING;
+        MaybeConfirm();
+      } else {
+        LOG(("TRRservice CP clear when already up!\n"));
+      }
+      mCaptiveIsPassed = true;
     }
 
-    mConfirmationState = CONFIRM_TRYING;
-    MaybeConfirm();
-    mCaptiveIsPassed = true;
-
   } else if (!strcmp(aTopic, kClearPrivateData) ||
              !strcmp(aTopic, kPurge)) {
     // flush the TRR blacklist, both in-memory and on-disk
     if (mTRRBLStorage) {
       mTRRBLStorage->Clear();
     }
   }
   return NS_OK;