From 306041f4ac3af3c7d7e32ac7753980ffe6f1e5a1 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 21 Apr 2024 10:25:51 -0400 Subject: [PATCH] LibWebView: Do not update cookie access time when fetched with WebDriver When WebDriver accesses cookies, it specifically says to run: the first step of the algorithm in RFC6265 to compute cookie-string So we should skip subsequent steps. We already skip step 2, which sorts the cookies, but neglected to skip step 3 to update their last access time. --- Userland/Libraries/LibWebView/CookieJar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWebView/CookieJar.cpp b/Userland/Libraries/LibWebView/CookieJar.cpp index 7b30a998f6a..a463ce0b4b5 100644 --- a/Userland/Libraries/LibWebView/CookieJar.cpp +++ b/Userland/Libraries/LibWebView/CookieJar.cpp @@ -447,6 +447,10 @@ Vector CookieJar::get_matching_cookies(const URL::URL& url, }); }); + // NOTE: The WebDriver spec expects only step 1 above to be executed to match cookies. + if (mode == MatchingCookiesSpecMode::WebDriver) + return cookie_list; + // 3. Update the last-access-time of each cookie in the cookie-list to the current date and time. auto now = UnixDateTime::now();