Bug 962358 - Provide an observer event to close persistent connections. r=arthuredelstein
authorMike Perry <mikeperry-git@torproject.org>
Tue, 15 Sep 2015 20:35:00 +0200
changeset 265699 7d9434a0044fe41f18b1142016b59ba6aff3f640
parent 265698 8a9d8a55618352a0c4327bf32b72eca24f0cafe7
child 265700 ac5a2a6b2d92f72cd0311c92cde717f30299a12b
push id29467
push userkwierso@gmail.com
push dateFri, 02 Oct 2015 20:33:25 +0000
treeherdermozilla-central@2308353160d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarthuredelstein
bugs962358
milestone44.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 962358 - Provide an observer event to close persistent connections. r=arthuredelstein We need to prevent linkability across "New Identity", which includes closing keep-alive connections. Conflicts: netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.cpp
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -360,16 +360,18 @@ nsHttpHandler::Init()
     if (obsService) {
         // register the handler object as a weak callback as we don't need to worry
         // about shutdown ordering.
         obsService->AddObserver(this, "profile-change-net-teardown", true);
         obsService->AddObserver(this, "profile-change-net-restore", true);
         obsService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
         obsService->AddObserver(this, "net:clear-active-logins", true);
         obsService->AddObserver(this, "net:prune-dead-connections", true);
+        // Sent by the TorButton add-on in the Tor Browser
+        obsService->AddObserver(this, "net:prune-all-connections", true);
         obsService->AddObserver(this, "net:failed-to-process-uri-content", true);
         obsService->AddObserver(this, "last-pb-context-exited", true);
         obsService->AddObserver(this, "webapps-clear-data", true);
         obsService->AddObserver(this, "browser:purge-session-history", true);
         obsService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true);
         obsService->AddObserver(this, "application-background", true);
     }
 
@@ -2039,16 +2041,21 @@ nsHttpHandler::Observe(nsISupports *subj
         InitConnectionMgr();
     } else if (!strcmp(topic, "net:clear-active-logins")) {
         mAuthCache.ClearAll();
         mPrivateAuthCache.ClearAll();
     } else if (!strcmp(topic, "net:prune-dead-connections")) {
         if (mConnMgr) {
             mConnMgr->PruneDeadConnections();
         }
+    } else if (!strcmp(topic, "net:prune-all-connections")) {
+        if (mConnMgr) {
+            mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
+            mConnMgr->PruneDeadConnections();
+        }
     } else if (!strcmp(topic, "net:failed-to-process-uri-content")) {
         nsCOMPtr<nsIURI> uri = do_QueryInterface(subject);
         if (uri && mConnMgr) {
             mConnMgr->ReportFailedToProcess(uri);
         }
     } else if (!strcmp(topic, "last-pb-context-exited")) {
         mPrivateAuthCache.ClearAll();
         if (mConnMgr) {