Commit 567446a3 authored by Mike Perry's avatar Mike Perry
Browse files

Provide an observer event to close persistent connections

We need to prevent linkability across "New Identity", which includes closing
keep-alive connections.
parent 8fffe46c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -338,6 +338,7 @@ nsHttpHandler::Init()
        mObserverService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
        mObserverService->AddObserver(this, "net:clear-active-logins", true);
        mObserverService->AddObserver(this, "net:prune-dead-connections", true);
        mObserverService->AddObserver(this, "net:prune-all-connections", true);
        mObserverService->AddObserver(this, "net:failed-to-process-uri-content", true);
        mObserverService->AddObserver(this, "last-pb-context-exited", true);
        mObserverService->AddObserver(this, "webapps-clear-data", true);
@@ -1765,6 +1766,12 @@ nsHttpHandler::Observe(nsISupports *subject,
            mConnMgr->PruneDeadConnections();
        }
    }
    else if (strcmp(topic, "net:prune-all-connections") == 0) {
        if (mConnMgr) {
           mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
           mConnMgr->PruneDeadConnections();
        }
    }
    else if (strcmp(topic, "net:failed-to-process-uri-content") == 0) {
        nsCOMPtr<nsIURI> uri = do_QueryInterface(subject);
        if (uri && mConnMgr)