From f326f087fa97794c2fe12483462e498e33d929ef Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Fri, 20 Mar 2026 14:06:57 +0100 Subject: [PATCH] Tests/LibWeb: Prevent inadvertent cookie expiration We were testing cookie expiry by setting moving a Date 1000ms to the future, and then calling `.toUTCString()` on it. However, that method truncates milliseconds and could cause the actual expiry to be almost immediately - that makes this test flaky, especially on slower machines. Fix the issue by using a larger expiry. --- Tests/LibWeb/Text/input/cookie-working.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/LibWeb/Text/input/cookie-working.html b/Tests/LibWeb/Text/input/cookie-working.html index 11073692d9..1a33f6c97a 100644 --- a/Tests/LibWeb/Text/input/cookie-working.html +++ b/Tests/LibWeb/Text/input/cookie-working.html @@ -140,13 +140,13 @@ }; const expiresTest = () => { - let expiry = new Date(Date.now() + 1000); + let expiry = new Date(Date.now() + 3000); expiry = expiry.toUTCString(); document.cookie = `cookie-expires=value; expires=${expiry}`; printCookies("Expires (before expiration)"); - internals.expireCookiesWithTimeOffset(2); + internals.expireCookiesWithTimeOffset(4); printCookies("Expires (after expiration)"); };