WebContent: Change the cookie setting IPC to be synchronous

Considering an operation like the following:

    document.cookie = "cookie=value";
    const value = document.cookie;

If the IPC for the cookie setter is asynchronous, the getter can execute
while the browser/SQLServer processes are still handling the setter.
This is often seen when hammering the document with cookie requests.
This commit is contained in:
Timothy Flynn 2024-01-10 12:23:00 -05:00 committed by Andreas Kling
parent 5c5cbeb491
commit a4f862a869
Notes: sideshowbarker 2024-07-17 10:31:19 +09:00
2 changed files with 6 additions and 2 deletions

View file

@ -504,7 +504,11 @@ ByteString PageClient::page_did_request_cookie(const URL& url, Web::Cookie::Sour
void PageClient::page_did_set_cookie(const URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)
{
client().async_did_set_cookie(url, cookie, static_cast<u8>(source));
auto response = client().send_sync_but_allow_failure<Messages::WebContentClient::DidSetCookie>(url, cookie, static_cast<u8>(source));
if (!response) {
dbgln("WebContent client disconnected during DidSetCookie. Exiting peacefully.");
exit(0);
}
}
void PageClient::page_did_update_cookie(Web::Cookie::Cookie cookie)

View file

@ -54,7 +54,7 @@ endpoint WebContentClient
did_request_all_cookies(URL url) => (Vector<Web::Cookie::Cookie> cookies)
did_request_named_cookie(URL url, ByteString name) => (Optional<Web::Cookie::Cookie> cookie)
did_request_cookie(URL url, u8 source) => (ByteString cookie)
did_set_cookie(URL url, Web::Cookie::ParsedCookie cookie, u8 source) =|
did_set_cookie(URL url, Web::Cookie::ParsedCookie cookie, u8 source) => ()
did_update_cookie(Web::Cookie::Cookie cookie) =|
did_update_resource_count(i32 count_waiting) =|
did_request_new_tab(Web::HTML::ActivateTab activate_tab) => (String handle)