diff --git a/Libraries/LibWeb/DOM/DocumentLoading.h b/Libraries/LibWeb/DOM/DocumentLoading.h index 6e0891d48d5..0dc81bc50e2 100644 --- a/Libraries/LibWeb/DOM/DocumentLoading.h +++ b/Libraries/LibWeb/DOM/DocumentLoading.h @@ -57,21 +57,21 @@ GC::Ref create_document_for_inline_content(GC::Ptrurl_list().append(URL::about_error()); // AD-HOC: https://github.com/whatwg/html/issues/9122 - auto navigation_params = vm.heap().allocate(); - navigation_params->id = move(navigation_id); - navigation_params->navigable = navigable; - navigation_params->request = nullptr; - navigation_params->response = response; - navigation_params->fetch_controller = nullptr; - navigation_params->commit_early_hints = nullptr; - navigation_params->coop_enforcement_result = move(coop_enforcement_result); - navigation_params->reserved_environment = {}; - navigation_params->origin = move(origin); - navigation_params->policy_container = vm.heap().allocate(vm.heap()); - navigation_params->final_sandboxing_flag_set = HTML::SandboxingFlagSet {}; - navigation_params->opener_policy = move(coop); - navigation_params->about_base_url = {}; - navigation_params->user_involvement = user_involvement; + auto navigation_params = vm.heap().allocate( + move(navigation_id), + navigable, + nullptr, + response, + nullptr, + nullptr, + move(coop_enforcement_result), + nullptr, + move(origin), + vm.heap().allocate(vm.heap()), + HTML::SandboxingFlagSet {}, + move(coop), + OptionalNone {}, + user_involvement); // 5. Let document be the result of creating and initializing a Document object given "html", "text/html", and navigationParams. auto document = DOM::Document::create_and_initialize(DOM::Document::Type::HTML, "text/html"_string, navigation_params).release_value_but_fixme_should_propagate_errors(); diff --git a/Libraries/LibWeb/HTML/Navigable.cpp b/Libraries/LibWeb/HTML/Navigable.cpp index 742f347b07e..8e2aca5c44a 100644 --- a/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Libraries/LibWeb/HTML/Navigable.cpp @@ -751,19 +751,21 @@ static GC::Ref create_navigation_params_from_a_srcdoc_resource // FIXME: navigation timing type: navTimingType // about base URL: entry's document state's about base URL // user involvement: userInvolvement - auto navigation_params = vm.heap().allocate(); - navigation_params->id = move(navigation_id); - navigation_params->navigable = navigable; - navigation_params->response = response; - navigation_params->coop_enforcement_result = move(coop_enforcement_result); - navigation_params->origin = move(response_origin); - navigation_params->policy_container = *policy_container; - navigation_params->final_sandboxing_flag_set = target_snapshot_params.sandboxing_flags; - navigation_params->opener_policy = move(coop); - navigation_params->about_base_url = entry->document_state()->about_base_url(); - navigation_params->user_involvement = user_involvement; - - return navigation_params; + return vm.heap().allocate( + move(navigation_id), + navigable, + nullptr, + response, + nullptr, + nullptr, + move(coop_enforcement_result), + nullptr, + move(response_origin), + *policy_container, + target_snapshot_params.sandboxing_flags, + move(coop), + entry->document_state()->about_base_url(), + user_involvement); } // https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching @@ -1165,22 +1167,21 @@ static WebIDL::ExceptionOr create_navigation // FIXME: navigation timing type: navTimingType // about base URL: entry's document state's about base URL // user involvement: userInvolvement - auto navigation_params = vm.heap().allocate(); - navigation_params->id = navigation_id; - navigation_params->navigable = navigable; - navigation_params->request = request; - navigation_params->response = *response_holder->response(); - navigation_params->fetch_controller = fetch_controller; - navigation_params->commit_early_hints = move(commit_early_hints); - navigation_params->coop_enforcement_result = coop_enforcement_result; - navigation_params->reserved_environment = request->reserved_client(); - navigation_params->origin = *response_origin; - navigation_params->policy_container = result_policy_container; - navigation_params->final_sandboxing_flag_set = final_sandbox_flags; - navigation_params->opener_policy = response_coop; - navigation_params->about_base_url = entry->document_state()->about_base_url(); - navigation_params->user_involvement = user_involvement; - return navigation_params; + return vm.heap().allocate( + navigation_id, + navigable, + request, + *response_holder->response(), + fetch_controller, + move(commit_early_hints), + coop_enforcement_result, + request->reserved_client(), + *response_origin, + result_policy_container, + final_sandbox_flags, + response_coop, + entry->document_state()->about_base_url(), + user_involvement); } // https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document @@ -1891,21 +1892,21 @@ GC::Ptr Navigable::evaluate_javascript_url(URL::URL const& url, U // FIXME: navigation timing type: "navigate" // about base URL: targetNavigable's active document's about base URL // user involvement: userInvolvement - auto navigation_params = vm.heap().allocate(); - navigation_params->id = navigation_id; - navigation_params->navigable = this; - navigation_params->request = {}; - navigation_params->response = response; - navigation_params->fetch_controller = nullptr; - navigation_params->commit_early_hints = nullptr; - navigation_params->coop_enforcement_result = move(coop_enforcement_result); - navigation_params->reserved_environment = {}; - navigation_params->origin = new_document_origin; - navigation_params->policy_container = policy_container; - navigation_params->final_sandboxing_flag_set = final_sandbox_flags; - navigation_params->opener_policy = coop; - navigation_params->about_base_url = active_document()->about_base_url(); - navigation_params->user_involvement = user_involvement; + auto navigation_params = vm.heap().allocate( + navigation_id, + this, + nullptr, + response, + nullptr, + nullptr, + move(coop_enforcement_result), + nullptr, + new_document_origin, + policy_container, + final_sandbox_flags, + coop, + active_document()->about_base_url(), + user_involvement); // 17. Return the result of loading an HTML document given navigationParams. return load_document(navigation_params); diff --git a/Libraries/LibWeb/HTML/NavigationParams.h b/Libraries/LibWeb/HTML/NavigationParams.h index db0c380f703..36eb5b6444c 100644 --- a/Libraries/LibWeb/HTML/NavigationParams.h +++ b/Libraries/LibWeb/HTML/NavigationParams.h @@ -76,7 +76,40 @@ struct NavigationParams : GC::Cell { // a user navigation involvement used when obtaining a browsing context for the new Document UserNavigationInvolvement user_involvement; +protected: void visit_edges(Visitor& visitor) override; + + NavigationParams( + Optional id, + GC::Ptr navigable, + GC::Ptr request, + GC::Ptr response, + GC::Ptr fetch_controller, + Function commit_early_hints, + OpenerPolicyEnforcementResult coop_enforcement_result, + Fetch::Infrastructure::Request::ReservedClientType reserved_environment, + URL::Origin origin, + GC::Ptr policy_container, + SandboxingFlagSet final_sandboxing_flag_set, + OpenerPolicy opener_policy, + Optional about_base_url, + UserNavigationInvolvement user_involvement) + : id(move(id)) + , navigable(navigable) + , request(request) + , response(response) + , fetch_controller(fetch_controller) + , commit_early_hints(move(commit_early_hints)) + , coop_enforcement_result(move(coop_enforcement_result)) + , reserved_environment(reserved_environment) + , origin(move(origin)) + , policy_container(policy_container) + , final_sandboxing_flag_set(final_sandboxing_flag_set) + , opener_policy(opener_policy) + , about_base_url(move(about_base_url)) + , user_involvement(user_involvement) + { + } }; // https://html.spec.whatwg.org/multipage/browsing-the-web.html#non-fetch-scheme-navigation-params diff --git a/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp b/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp index cc542b4e83d..469d6b1082b 100644 --- a/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp +++ b/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp @@ -37,13 +37,20 @@ ErrorOr> SVGDecodedImageData::create(JS::Realm& rea GC::Ref navigable = page->top_level_traversable(); auto response = Fetch::Infrastructure::Response::create(navigable->vm()); response->url_list().append(url); - auto navigation_params = navigable->heap().allocate(); - navigation_params->navigable = navigable; - navigation_params->response = response; - navigation_params->origin = URL::Origin {}; - navigation_params->policy_container = navigable->heap().allocate(realm.heap()); - navigation_params->final_sandboxing_flag_set = HTML::SandboxingFlagSet {}; - navigation_params->opener_policy = HTML::OpenerPolicy {}; + auto navigation_params = navigable->heap().allocate(OptionalNone {}, + navigable, + nullptr, + response, + nullptr, + nullptr, + HTML::OpenerPolicyEnforcementResult {}, + nullptr, + URL::Origin {}, + navigable->heap().allocate(realm.heap()), + HTML::SandboxingFlagSet {}, + HTML::OpenerPolicy {}, + OptionalNone {}, + HTML::UserNavigationInvolvement::None); // FIXME: Use Navigable::navigate() instead of manually replacing the navigable's document. auto document = MUST(DOM::Document::create_and_initialize(DOM::Document::Type::HTML, "text/html"_string, navigation_params));