ladybird/Libraries/LibWeb/Fetch
Timothy Flynn 0482b6bb57 LibWeb+LibWebView+WebContent: Implement versioning for document cookies
This patch introduces a cookie cache in the WebContent process to reduce
blocking IPC calls when JS accesses document.cookie. The UI process now
maintains a cookie version counter per-domain in shared memory. When JS
reads document.cookie, we check whether we have a valid cached cookie by
comparing the current shared version to the last used version. If they
match, the cached cookie is returned without IPC.

This optimization is based on Chromium's shared versioning, in which it
was observed that 87% of document.cookie accesses were redundant. See:
https://blog.chromium.org/2024/06/introducing-shared-memory-versioning-to.html

Note that this cache only supports document.cookie, not HTTP Cookie
headers. HTTP cookies are attached to requests with varying URLs and
paths. The cookies that match the document URL might not match the
request URL, which we wouldn't know from WebContent. So attaching the
cached document cookie would be incorrect.

On https://twinings.co.uk, we see approximately 600 document.cookie
requests while the page loads. This patch reduces the time spent in
the document.cookie getter from ~45ms to 2-3ms.
2026-02-05 07:28:07 -05:00
..
Fetching LibWeb+LibWebView+WebContent: Implement versioning for document cookies 2026-02-05 07:28:07 -05:00
Infrastructure LibWeb: Make FetchController::stop_fetch() cancel the request 2026-01-29 05:22:27 -06:00
Body.cpp LibWeb: Add missing GC visits for XHR::FormDataEntry 2025-12-26 19:48:46 +01:00
Body.h LibWeb: Add missing GC visits for XHR::FormDataEntry 2025-12-26 19:48:46 +01:00
Body.idl
BodyInit.cpp LibWeb: Store HTTP methods and headers as ByteString 2025-11-26 09:15:06 -05:00
BodyInit.h LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
BodyInit.idl
Enums.cpp LibHTTP+LibWeb: Move Infrastructure::Request::CacheMode to LibHTTP 2026-01-22 07:05:06 -05:00
Enums.h LibHTTP+LibWeb: Move Infrastructure::Request::CacheMode to LibHTTP 2026-01-22 07:05:06 -05:00
FetchMethod.cpp LibWeb: Remove exception throwing from Fetch 2025-11-07 04:08:30 +01:00
FetchMethod.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Headers.cpp LibHTTP+LibWeb+RequestServer: Move Fetch's HTTP header infra to LibHTTP 2025-11-27 14:57:29 +01:00
Headers.h LibHTTP+LibWeb+RequestServer: Move Fetch's HTTP header infra to LibHTTP 2025-11-27 14:57:29 +01:00
Headers.idl
HeadersIterator.cpp LibTextCodec+LibWeb: Move isomorphic coders to LibTextCodec 2025-11-27 14:57:29 +01:00
HeadersIterator.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Request.cpp LibHTTP+LibWeb: Move Infrastructure::Request::CacheMode to LibHTTP 2026-01-22 07:05:06 -05:00
Request.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Request.idl
Response.cpp LibHTTP+LibWeb+RequestServer: Move Fetch's HTTP header infra to LibHTTP 2025-11-27 14:57:29 +01:00
Response.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Response.idl