[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit d57b416593b4e4588c387374a230cc4a3f25ce87
Author: Matthew Finkel <sysrqb@xxxxxxxxxxxxxx>
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       | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/netwerk/protocol/http/nsCORSListenerProxy.cpp b/netwerk/protocol/http/nsCORSListenerProxy.cpp
index 76870e6cea3f..6d2e160c2a9b 100644
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -346,6 +346,13 @@ void nsCORSListenerProxy::Shutdown() {
   sPreflightCache = nullptr;
 }
 
+/* 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 8c0df2e0ff28..3f76be33f209 100644
--- a/netwerk/protocol/http/nsCORSListenerProxy.h
+++ b/netwerk/protocol/http/nsCORSListenerProxy.h
@@ -54,6 +54,7 @@ class nsCORSListenerProxy final : public nsIStreamListener,
   NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
 
   static void Shutdown();
+  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 d5e2c61dbec9..c6cb95ca7fcc 100644
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -10,6 +10,7 @@
 #include "prsystem.h"
 
 #include "AltServiceChild.h"
+#include "nsCORSListenerProxy.h"
 #include "nsError.h"
 #include "nsHttp.h"
 #include "nsHttpHandler.h"
@@ -2290,6 +2291,7 @@ nsHttpHandler::Observe(nsISupports* subject, const char* topic,
         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)) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits