mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Add some tests that exercise the HTTP disk cache
Our HTTP disk cache is currently manually tested against various sites. This patch adds some tests to cover various scenarios, including non- cacheable responses, expired responses, and revalidation. In order to ensure we hit the disk cache in RequestServer, we must disable the in-memory cache in WebContent.
This commit is contained in:
parent
a4c8e39b99
commit
813986237e
Notes:
github-actions[bot]
2025-11-20 08:35:21 +00:00
Author: https://github.com/trflynn89
Commit: 813986237e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6861
Reviewed-by: https://github.com/gmta ✅
7 changed files with 353 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/DOM/NodeList.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
#include <LibWeb/HTML/HTMLElement.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
|
@ -298,6 +299,13 @@ void Internals::expire_cookies_with_time_offset(WebIDL::LongLong seconds)
|
|||
page().client().page_did_expire_cookies_with_time_offset(AK::Duration::from_seconds(seconds));
|
||||
}
|
||||
|
||||
bool Internals::set_http_memory_cache_enabled(bool enabled)
|
||||
{
|
||||
auto was_enabled = Web::Fetch::Fetching::http_cache_enabled();
|
||||
Web::Fetch::Fetching::set_http_cache_enabled(enabled);
|
||||
return was_enabled;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static
|
||||
String Internals::get_computed_role(DOM::Element& element)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ public:
|
|||
void enable_cookies_on_file_domains();
|
||||
void expire_cookies_with_time_offset(WebIDL::LongLong seconds);
|
||||
|
||||
bool set_http_memory_cache_enabled(bool enabled);
|
||||
|
||||
String get_computed_role(DOM::Element& element);
|
||||
String get_computed_label(DOM::Element& element);
|
||||
String get_computed_aria_level(DOM::Element& element);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ interface Internals {
|
|||
undefined enableCookiesOnFileDomains();
|
||||
undefined expireCookiesWithTimeOffset(long long seconds);
|
||||
|
||||
boolean setHttpMemoryCacheEnabled(boolean enabled);
|
||||
|
||||
DOMString getComputedRole(Element element);
|
||||
DOMString getComputedLabel(Element element);
|
||||
DOMString getComputedAriaLevel(Element element);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue