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

@@ -183,6 +183,11 @@ void Internals::simulate_drop(double x, double y)
page.handle_drag_and_drop_event(DragEvent::Type::Drop, position, position, UIEvents::MouseButton::Primary, 0, 0, {});
}
void Internals::enable_cookies_on_file_domains()
{
internals_window().associated_document().enable_cookies_on_file_domains({});
}
void Internals::expire_cookies_with_time_offset(WebIDL::LongLong seconds)
{
internals_page().client().page_did_expire_cookies_with_time_offset(AK::Duration::from_seconds(seconds));