LibWeb: Implement the document.cookie setter/getter according to spec

This ensures we cannot set or get cookies on non-HTTP(S) origins. Since
this would prevent our ability to test cookies during LibWeb tests, this
also adds an internals API to allow cookie access on file:// URLs.
This commit is contained in:
Timothy Flynn
2024-10-22 13:47:06 -04:00
committed by Andreas Kling
parent 86744449e3
commit 527218da19
Notes: github-actions[bot] 2024-10-23 07:06:33 +00:00
7 changed files with 69 additions and 8 deletions

View File

@@ -12,6 +12,11 @@
document.cookie = `${name}=""; max-age=-9999`;
};
const cookieAverseTest = () => {
document.cookie = "cookie=value";
printCookies("Cookie averse test");
};
const basicTest = () => {
document.cookie = "cookie=value";
printCookies("Basic test");
@@ -178,6 +183,10 @@
};
test(() => {
cookieAverseTest();
internals.enableCookiesOnFileDomains();
basicTest();
multipleCookiesTest();