diff --git a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index 8a4cc1342af..cc9480f7bd2 100644 --- a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -1669,6 +1669,11 @@ public: return s_cache; } + void clear_cache() + { + m_cache.clear(); + } + private: HashMap> m_cache; }; @@ -2849,4 +2854,9 @@ void set_http_cache_enabled(bool const enabled) g_http_cache_enabled = enabled; } +void clear_http_cache() +{ + HTTPCache::the().clear_cache(); +} + } diff --git a/Libraries/LibWeb/Fetch/Fetching/Fetching.h b/Libraries/LibWeb/Fetch/Fetching/Fetching.h index 0d5164ffae2..993b354b736 100644 --- a/Libraries/LibWeb/Fetch/Fetching/Fetching.h +++ b/Libraries/LibWeb/Fetch/Fetching/Fetching.h @@ -56,5 +56,6 @@ void set_sec_fetch_user_header(Infrastructure::Request&); void append_fetch_metadata_headers_for_request(Infrastructure::Request&); WEB_API void set_http_cache_enabled(bool enabled); +WEB_API void clear_http_cache(); } diff --git a/Libraries/LibWebView/Application.cpp b/Libraries/LibWebView/Application.cpp index 6f3dd570a91..fc72d1f277a 100644 --- a/Libraries/LibWebView/Application.cpp +++ b/Libraries/LibWebView/Application.cpp @@ -830,7 +830,7 @@ void Application::initialize_actions() m_debug_menu->add_separator(); m_debug_menu->add_action(Action::create("Collect Garbage"sv, ActionID::CollectGarbage, debug_request("collect-garbage"sv))); - m_debug_menu->add_action(Action::create("Clear Cache"sv, ActionID::ClearCache, [this, clear_memory_cache = debug_request("clear_cache")]() { + m_debug_menu->add_action(Action::create("Clear Cache"sv, ActionID::ClearCache, [this, clear_memory_cache = debug_request("clear-cache")]() { m_request_server_client->async_clear_cache(); clear_memory_cache(); })); diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp index 41755366bac..544e183fe91 100644 --- a/Services/WebContent/ConnectionFromClient.cpp +++ b/Services/WebContent/ConnectionFromClient.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -386,7 +387,7 @@ void ConnectionFromClient::debug_request(u64 page_id, ByteString request, ByteSt } if (request == "clear-cache") { - // FIXME: Clear the Fetch cache. + Web::Fetch::Fetching::clear_http_cache(); return; }