ladybird/Libraries/LibWeb/Worker
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
..
WebWorkerClient.cpp LibWeb+LibWebView+WebContent: Implement versioning for document cookies 2026-02-05 07:28:07 -05:00
WebWorkerClient.h LibWeb+LibWebView+WebContent: Implement versioning for document cookies 2026-02-05 07:28:07 -05:00
WebWorkerClient.ipc LibWeb+LibWebView+WebContent: Implement versioning for document cookies 2026-02-05 07:28:07 -05:00
WebWorkerServer.ipc LibWeb: Ensure that worker script fetches set the correct referrer 2026-01-31 22:45:08 +01:00