mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-30 06:52:52 +00:00
LibWeb: Make HTML::Window::page() return a Page&
This commit is contained in:
parent
7c95ebc302
commit
9793d69d4f
Notes:
sideshowbarker
2024-07-17 08:37:36 +09:00
Author: https://github.com/awesomekling
Commit: 9793d69d4f
Pull-request: https://github.com/SerenityOS/serenity/pull/22299
Issue: https://github.com/SerenityOS/serenity/issues/22290
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/Lubrsi
10 changed files with 40 additions and 83 deletions
|
@ -1722,19 +1722,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_load
|
|||
|
||||
auto request = fetch_params.request();
|
||||
|
||||
Page* page = nullptr;
|
||||
auto& global_object = realm.global_object();
|
||||
if (is<HTML::Window>(global_object))
|
||||
page = static_cast<HTML::Window&>(global_object).page();
|
||||
else if (is<HTML::WorkerGlobalScope>(global_object))
|
||||
page = static_cast<HTML::WorkerGlobalScope&>(global_object).page();
|
||||
auto& page = Bindings::host_defined_page(realm);
|
||||
|
||||
// NOTE: Using LoadRequest::create_for_url_on_page here will unconditionally add cookies as long as there's a page available.
|
||||
// However, it is up to http_network_or_cache_fetch to determine if cookies should be added to the request.
|
||||
LoadRequest load_request;
|
||||
load_request.set_url(request->current_url());
|
||||
if (page)
|
||||
load_request.set_page(*page);
|
||||
load_request.set_page(page);
|
||||
load_request.set_method(DeprecatedString::copy(request->method()));
|
||||
for (auto const& header : *request->header_list())
|
||||
load_request.set_header(DeprecatedString::copy(header.name), DeprecatedString::copy(header.value));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue