From c00760c5f9ca72b89b39feb7042978da2f15eef3 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 13 Apr 2021 17:30:41 -0400 Subject: Browser+LibWeb+WebContent: Track the source of document.cookie requests To implement the HttpOnly attribute, the CookieJar needs to know where a request originated from. Namely, it needs to distinguish between HTTP / non-HTTP (i.e. JavaScript) requests. When the HttpOnly attribute is set, requests from JavaScript are to be blocked. --- Userland/Applications/Browser/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Userland/Applications/Browser/main.cpp') diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 0d995bf9ca..4f4a73c75a 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -219,12 +219,12 @@ int main(int argc, char** argv) }); }; - new_tab.on_get_cookie = [&](auto& url) -> String { - return cookie_jar.get_cookie(url); + new_tab.on_get_cookie = [&](auto& url, auto source) -> String { + return cookie_jar.get_cookie(url, source); }; - new_tab.on_set_cookie = [&](auto& url, auto& cookie) { - cookie_jar.set_cookie(url, cookie); + new_tab.on_set_cookie = [&](auto& url, auto& cookie, auto source) { + cookie_jar.set_cookie(url, cookie, source); }; new_tab.on_dump_cookies = [&]() { -- cgit v1.2.3