[tbb-commits] [tor-browser/tor-browser-91.2.0esr-11.0-1] Bug 40475: Include clearing CORS preflight cache

sysrqb at torproject.org sysrqb at torproject.org
Wed Oct 6 13:32:12 UTC 2021


commit f74d4b7255c8a8c958a6d574928d230244d0a346
Author: Matthew Finkel <sysrqb at torproject.org>
Date:   Sun Jun 6 20:32:23 2021 +0000

    Bug 40475: Include clearing CORS preflight cache
---
 netwerk/protocol/http/nsCORSListenerProxy.cpp | 7 +++++++
 netwerk/protocol/http/nsCORSListenerProxy.h   | 1 +
 netwerk/protocol/http/nsHttpHandler.cpp       | 1 +
 3 files changed, 9 insertions(+)

diff --git a/netwerk/protocol/http/nsCORSListenerProxy.cpp b/netwerk/protocol/http/nsCORSListenerProxy.cpp
index 1de4e2abed4a..9ece2020bc7d 100644
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -358,6 +358,13 @@ void nsCORSListenerProxy::ClearCache() {
   sPreflightCache->Clear();
 }
 
+/* static */
+void nsCORSListenerProxy::Clear() {
+  if (sPreflightCache) {
+    sPreflightCache->Clear();
+  }
+}
+
 nsCORSListenerProxy::nsCORSListenerProxy(nsIStreamListener* aOuter,
                                          nsIPrincipal* aRequestingPrincipal,
                                          bool aWithCredentials)
diff --git a/netwerk/protocol/http/nsCORSListenerProxy.h b/netwerk/protocol/http/nsCORSListenerProxy.h
index e3f1ff27f1d1..5b858223028f 100644
--- a/netwerk/protocol/http/nsCORSListenerProxy.h
+++ b/netwerk/protocol/http/nsCORSListenerProxy.h
@@ -59,6 +59,7 @@ class nsCORSListenerProxy final : public nsIStreamListener,
 
   static void Shutdown();
   static void ClearCache();
+  static void Clear();
 
   [[nodiscard]] nsresult Init(nsIChannel* aChannel,
                               DataURIHandling aAllowDataURI);
diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp
index 0bb944164652..5925c4598bc1 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -2167,6 +2167,7 @@ nsHttpHandler::Observe(nsISupports* subject, const char* topic,
     if (mAltSvcCache) {
       mAltSvcCache->ClearAltServiceMappings();
     }
+    nsCORSListenerProxy::Clear();
   } else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
     nsAutoCString converted = NS_ConvertUTF16toUTF8(data);
     if (!strcmp(converted.get(), NS_NETWORK_LINK_DATA_CHANGED)) {





More information about the tbb-commits mailing list