7070
7171namespace Web ::Fetch::Fetching {
7272
73- bool g_http_cache_enabled = false ;
73+ bool g_http_memory_cache_enabled = false ;
7474
7575#define TRY_OR_IGNORE (expression ) \
7676 ({ \
@@ -1424,14 +1424,14 @@ class CachePartition : public RefCounted<CachePartition> {
14241424 // - the presented target URI (Section 7.1 of [HTTP]) and that of the stored response match, and
14251425 auto it = m_cache.find (url);
14261426 if (it == m_cache.end ()) {
1427- dbgln_if (HTTP_CACHE_DEBUG , " \033 [31;1mHTTP CACHE MISS!\033 [0m {}" , url);
1427+ dbgln_if (HTTP_MEMORY_CACHE_DEBUG , " \033 [31;1mHTTP CACHE MISS!\033 [0m {}" , url);
14281428 return {};
14291429 }
14301430 auto const & cached_response = it->value ;
14311431
14321432 // - the request method associated with the stored response allows it to be used for the presented request, and
14331433 if (method != cached_response->method ()) {
1434- dbgln_if (HTTP_CACHE_DEBUG , " \033 [31;1mHTTP CACHE MISS!\033 [0m (Bad method) {}" , url);
1434+ dbgln_if (HTTP_MEMORY_CACHE_DEBUG , " \033 [31;1mHTTP CACHE MISS!\033 [0m (Bad method) {}" , url);
14351435 return {};
14361436 }
14371437
@@ -1445,7 +1445,7 @@ class CachePartition : public RefCounted<CachePartition> {
14451445 // + allowed to be served stale (see Section 4.2.4), or
14461446 // + successfully validated (see Section 4.3).
14471447
1448- dbgln_if (HTTP_CACHE_DEBUG , " \033 [32;1mHTTP CACHE HIT!\033 [0m {}" , url);
1448+ dbgln_if (HTTP_MEMORY_CACHE_DEBUG , " \033 [32;1mHTTP CACHE HIT!\033 [0m {}" , url);
14491449 return cached_response->clone (realm);
14501450 }
14511451
@@ -1498,7 +1498,7 @@ class HTTPCache {
14981498// https://fetch.spec.whatwg.org/#determine-the-http-cache-partition
14991499static RefPtr<CachePartition> determine_the_http_cache_partition (Infrastructure::Request const & request)
15001500{
1501- if (!g_http_cache_enabled )
1501+ if (!g_http_memory_cache_enabled )
15021502 return nullptr ;
15031503
15041504 // 1. Let key be the result of determining the network partition key given request.
@@ -1905,7 +1905,7 @@ GC::Ref<PendingResponse> http_network_or_cache_fetch(JS::Realm& realm, Infrastru
19051905
19061906 // 4. If the revalidatingFlag is set and forwardResponse’s status is 304, then:
19071907 if (revalidating_flag->value () && forward_response->status () == 304 ) {
1908- dbgln_if (HTTP_CACHE_DEBUG , " \033 [34;1mHTTP CACHE REVALIDATE (304)\033 [0m {}" , http_request->current_url ());
1908+ dbgln_if (HTTP_MEMORY_CACHE_DEBUG , " \033 [34;1mHTTP CACHE REVALIDATE (304)\033 [0m {}" , http_request->current_url ());
19091909
19101910 // 1. Update storedResponse’s header list using forwardResponse’s header list, as per the "Freshening
19111911 // Stored Responses upon Validation" chapter of HTTP Caching.
@@ -2524,17 +2524,17 @@ void append_fetch_metadata_headers_for_request(Infrastructure::Request& request)
25242524 set_sec_fetch_user_header (request);
25252525}
25262526
2527- void set_http_cache_enabled (bool const enabled)
2527+ void set_http_memory_cache_enabled (bool const enabled)
25282528{
2529- g_http_cache_enabled = enabled;
2529+ g_http_memory_cache_enabled = enabled;
25302530}
25312531
2532- bool http_cache_enabled ()
2532+ bool http_memory_cache_enabled ()
25332533{
2534- return g_http_cache_enabled ;
2534+ return g_http_memory_cache_enabled ;
25352535}
25362536
2537- void clear_http_cache ()
2537+ void clear_http_memory_cache ()
25382538{
25392539 HTTPCache::the ().clear_cache ();
25402540}
0 commit comments