mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb+WebContent: Hook Fetch's HTTP cache into the clear-cache action
And fix a typo in an invocation to clear the cache.
This commit is contained in:
parent
ac246caa0c
commit
e0a8eb3767
Notes:
github-actions[bot]
2025-11-05 17:28:33 +00:00
Author: https://github.com/trflynn89
Commit: e0a8eb3767
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6708
4 changed files with 14 additions and 2 deletions
|
|
@ -1669,6 +1669,11 @@ public:
|
|||
return s_cache;
|
||||
}
|
||||
|
||||
void clear_cache()
|
||||
{
|
||||
m_cache.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
HashMap<Infrastructure::NetworkPartitionKey, NonnullRefPtr<CachePartition>> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/SelectedFile.h>
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue