LibWeb: Get document for cookies usage from principal realm

Needed for when a shadow realm does an HTTP fetch as part of an import.
This commit is contained in:
Shannon Booth 2024-11-28 03:05:11 +13:00 committed by Andreas Kling
parent bc10729af6
commit fb17f8ff66
Notes: github-actions[bot] 2024-11-30 11:07:23 +00:00

View file

@ -1880,7 +1880,7 @@ WebIDL::ExceptionOr<GC::Ref<PendingResponse>> http_network_or_cache_fetch(JS::Re
// with the user agents cookie store and httpRequests current URL.
auto cookies = ([&] {
// FIXME: Getting to the page client reliably is way too complicated, and going via the document won't work in workers.
auto document = Bindings::principal_host_defined_environment_settings_object(realm).responsible_document();
auto document = Bindings::principal_host_defined_environment_settings_object(HTML::principal_realm(realm)).responsible_document();
if (!document)
return String {};
return document->page().client().page_did_request_cookie(http_request->current_url(), Cookie::Source::Http);