Skip to content

Truly independent web browser

LibWeb+LibWebView+WebContent: Build history population requests in UI

Shannon Boothe82ec50292e8
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.cpp b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
index 9c0ef0ca7c2..6e234f7bd11 100644
--- a/Libraries/LibWeb/HTML/HistoryExecutor.cpp
+++ b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibWeb/ContentSecurityPolicy/Directives/Directive.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/DocumentState.h>
@@ -21,10 +20,8 @@
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
#include <LibWeb/HTML/SourceSnapshotParams.h>
#include <LibWeb/HTML/StructuredSerialize.h>
-#include <LibWeb/HTML/TargetSnapshotParams.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Page/Page.h>
-#include <LibWeb/Platform/EventLoopPlugin.h>
namespace Web::HTML {
@@ -297,7 +294,7 @@ void HistoryExecutor::enqueue_changing_navigable_continuation(CrossProcessId ope
on_complete->function()(ChangingNavigableHistoryStepJobDisposition::Ready, continuation->update_only, target_document_id);
}
-void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId operation_id, CrossProcessId navigable_id, SessionHistoryEntryDescriptor target_entry_descriptor, UserNavigationInvolvement user_involvement, Optional<Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, Optional<NavigationSourceSnapshot> navigation_source_snapshot, GC::Ref<OnChangingNavigableHistoryStepJobComplete> on_complete, Optional<HistoryNavigationPopulation> population)
+void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId operation_id, CrossProcessId navigable_id, SessionHistoryEntryDescriptor target_entry_descriptor, UserNavigationInvolvement user_involvement, Optional<Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, bool needs_population, GC::Ref<OnChangingNavigableHistoryStepJobComplete> on_complete, Optional<HistoryNavigationPopulation> population)
{
auto& operation = ensure_history_operation(operation_id);
// The job for the navigation this process finalizes claims the entry it created, with the document it populated.
@@ -325,10 +322,6 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera
local_target_entry = navigable->resolve_local_session_history_entry(move(target_entry_descriptor));
}
- GC::Ptr<SourceSnapshotParams> source_snapshot_params;
- if (navigation_source_snapshot.has_value())
- source_snapshot_params = create_source_snapshot_params_from_navigation_source_snapshot(relevant_realm(*navigable->active_window()), *navigation_source_snapshot);
-
// 8.1. Let targetEntry be the result of getting the target history entry given navigable and targetStep.
// NB: The UI coordinator already ran that step against canonical history and sent the selected entry with this
// job. Retain that exact local entry instead of repeating the global-step lookup in WebContent.
@@ -359,7 +352,7 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera
operation.changing_navigable_jobs.ensure(navigable_id);
- queue_apply_history_step_task(*navigable, GC::create_function(heap(), [this, operation_id, navigation_type, finalized_navigation_id, user_involvement, population = move(population), source_snapshot_params, pending_document, claimed_target_entry = move(claimed_target_entry), navigable, on_complete]() mutable {
+ queue_apply_history_step_task(*navigable, GC::create_function(heap(), [this, operation_id, navigation_type, user_involvement, population = move(population), needs_population, pending_document, claimed_target_entry = move(claimed_target_entry), navigable, on_complete]() mutable {
// 1. Let displayedEntry be navigable's active session history entry.
auto displayed_entry = navigable->active_session_history_entry();
@@ -478,8 +471,8 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera
});
// 8. If targetEntry's document is null, or targetEntry's document state's reload pending is true, then:
- bool needs_population = !changing_navigable_continuation->target_document || target_entry->document_state()->reload_pending();
- if (needs_population) {
+ // NB: The UI process decides this, and runs the substeps but for step 4's snapshot of navigable's active document.
+ if (population.has_value() || needs_population) {
auto continue_population = GC::create_function(heap(), [this, navigable, after_document_populated](HistoryNavigationPopulation population) {
if (navigable->has_been_destroyed() || !navigable->active_window()) {
after_document_populated->function()(nullptr);
@@ -527,57 +520,16 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera
return;
operation->changing_navigable_jobs.ensure(navigable->id()).continue_population = continue_population;
- // FIXME: 1. Let navTimingType be "back_forward" if targetEntry's document is null; otherwise "reload".
-
- // 2. Let targetSnapshotParams be the result of snapshotting target snapshot params given navigable.
- auto target_snapshot_params = snapshot_target_snapshot_params(*navigable);
-
- // 3. Let potentiallyTargetSpecificSourceSnapshotParams be sourceSnapshotParams.
- auto potentially_target_specific_source_snapshot_params = source_snapshot_params;
-
// 4. If potentiallyTargetSpecificSourceSnapshotParams is null, then set it to the result of snapshotting source snapshot params given navigable's active document.
- if (!potentially_target_specific_source_snapshot_params)
- potentially_target_specific_source_snapshot_params = snapshot_source_snapshot_params(navigable->active_document());
+ // NB: The UI process holds sourceSnapshotParams, and takes this snapshot if that is null.
+ auto active_document_source_snapshot_params = snapshot_source_snapshot_params(navigable->active_document());
// 5. Set targetEntry's document state's reload pending to false.
- // AD-HOC: Preserve reload pending for steps 6 and 7 before step 5 clears it.
- // See https://github.com/whatwg/html/issues/12760.
- auto input_reload_pending = target_entry->document_state()->reload_pending();
- auto input_reload_bypasses_cache = target_entry->document_state()->reload_bypasses_cache();
+ // NB: This process's copy of targetEntry, which the UI process clears in its session history.
target_entry->document_state()->set_reload_pending(false);
target_entry->document_state()->set_reload_bypasses_cache(false);
- m_page->client().page_did_set_session_history_entry_document_state_reload_pending(
- navigable->id(), target_entry->navigation_api_key(), false);
-
- // 6. Let allowPOST be targetEntry's document state's reload pending.
- // AD-HOC: A document another page displayed, or a crashed process lost, is loaded again with its POST
- // resource, as the process that displayed it would have kept it.
- auto allow_POST = input_reload_pending || navigable->is_provisional();
-
- // NB: Population runs in a deferred task, during which sync navigations can change targetEntry. The request
- // holds the entry as it is now. See https://github.com/whatwg/html/issues/9869.
- auto request = NavigationPopulationRequest {
- .navigable_id = navigable->id(),
- .history_entry = create_pending_session_history_entry_descriptor(create_session_history_entry_descriptor(*target_entry)),
- .source_snapshot_params = create_navigation_source_snapshot(*potentially_target_specific_source_snapshot_params),
- .target_snapshot_params = target_snapshot_params,
- .csp_navigation_type = ContentSecurityPolicy::Directives::Directive::NavigationType::Other,
- .history_handling = Bindings::NavigationHistoryBehavior::Replace,
- .user_involvement = user_involvement,
- .navigation_id = finalized_navigation_id.value_or(Utf16String {}),
- };
- request.history_entry.document_state.reload_pending = input_reload_pending;
- request.history_entry.document_state.reload_bypasses_cache = input_reload_bypasses_cache;
-
- // 7. In parallel, attempt to populate the history entry's document for targetEntry, given navigable, potentiallyTargetSpecificSourceSnapshotParams,
- // targetSnapshotParams, userInvolvement, with allowPOST set to allowPOST and completionSteps set to
- // queue a global task on the navigation and traversal task source given navigable's active window to
- // run afterDocumentPopulated.
- Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(heap(), [this, operation_id, request = move(request), potentially_target_specific_source_snapshot_params, allow_POST, navigable] {
- navigable->populate_session_history_entry_document(request, *potentially_target_specific_source_snapshot_params, allow_POST, GC::create_function(heap(), [this, operation_id, request](NavigationPopulationResult result) mutable {
- m_page->client().history_navigation_params_creation_finished(operation_id, { move(request), move(result) });
- }));
- }));
+
+ m_page->client().changing_navigable_history_job_reached_population(operation_id, navigable->id(), create_navigation_source_snapshot(*active_document_source_snapshot_params));
}
// Otherwise, run afterDocumentPopulated immediately.
else {
@@ -586,6 +538,23 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera
}));
}
+// https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document
+// NB: For step 8.7 of a changing navigable's history step job, which the UI process runs, this process creates
+// navigationParams given the request.
+bool HistoryExecutor::create_ui_history_navigation_params(CrossProcessId operation_id, NavigationPopulationRequest request, bool allow_POST)
+{
+ auto* operation = find_history_operation(operation_id);
+ auto navigable = local_navigable_with_id(request.navigable_id);
+ if (!operation || !operation->changing_navigable_jobs.contains(request.navigable_id) || !navigable || navigable->has_been_destroyed() || !navigable->active_window())
+ return false;
+
+ auto source_snapshot_params = create_source_snapshot_params_from_navigation_source_snapshot(relevant_realm(*navigable->active_window()), request.source_snapshot_params);
+ navigable->populate_session_history_entry_document(request, source_snapshot_params, allow_POST, GC::create_function(heap(), [this, operation_id, navigable_id = request.navigable_id](NavigationPopulationResult result) {
+ m_page->client().history_navigation_params_creation_finished(operation_id, navigable_id, move(result));
+ }));
+ return true;
+}
+
// Step 5.2 of deactivate a document for a cross-document navigation: set navigable's ongoing navigation to null.
// NB: This mirrors it for the navigable whose job this operation's continuation is, and leaves a newer navigation's.
void HistoryExecutor::clear_ui_changing_navigable_ongoing_traversal(CrossProcessId operation_id, CrossProcessId navigable_id)
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.h b/Libraries/LibWeb/HTML/HistoryExecutor.h
index a0d53b9e28a..0d3a0a2b0fa 100644
--- a/Libraries/LibWeb/HTML/HistoryExecutor.h
+++ b/Libraries/LibWeb/HTML/HistoryExecutor.h
@@ -67,7 +67,8 @@ public:
void finalize_same_document_navigation(GC::Ref<LocalNavigable>, NonnullRefPtr<SessionHistoryEntry>, RefPtr<SessionHistoryEntry> entry_to_replace, HistoryHandlingBehavior, UserNavigationInvolvement, Optional<SessionHistoryEntryPersistedState> previous_entry_persisted_state);
void run_ui_beforeunload_check(Vector<CrossProcessId> navigable_ids, Optional<SessionHistoryEntryDescriptor> target_entry, Optional<UserNavigationInvolvement> user_involvement_for_navigate_event, UnloadPromptShown, GC::Ref<GC::Function<void(CheckIfUnloadingIsCanceledResult, UnloadPromptShown)>>);
- void run_ui_changing_navigable_history_job(CrossProcessId operation_id, CrossProcessId navigable_id, SessionHistoryEntryDescriptor target_entry_descriptor, UserNavigationInvolvement, Optional<Bindings::NavigationType>, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, Optional<NavigationSourceSnapshot>, GC::Ref<OnChangingNavigableHistoryStepJobComplete>, Optional<HistoryNavigationPopulation> = {});
+ void run_ui_changing_navigable_history_job(CrossProcessId operation_id, CrossProcessId navigable_id, SessionHistoryEntryDescriptor target_entry_descriptor, UserNavigationInvolvement, Optional<Bindings::NavigationType>, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, bool needs_population, GC::Ref<OnChangingNavigableHistoryStepJobComplete>, Optional<HistoryNavigationPopulation> = {});
+ bool create_ui_history_navigation_params(CrossProcessId operation_id, NavigationPopulationRequest, bool allow_POST);
bool resume_history_navigation_population(CrossProcessId operation_id, HistoryNavigationPopulation&&);
void apply_ui_changing_navigable_continuation(CrossProcessId operation_id, CrossProcessId navigable_id, SessionHistoryEntryIdentity target_entry_identity, HistoryObjectLengthAndIndex, Vector<SessionHistoryEntryDescriptor> entries_for_navigation_api, GC::Ref<OnChangingNavigableContinuationApplied>);
void unload_displayed_document_and_apply_ui_changing_navigable_continuation(CrossProcessId operation_id, CrossProcessId navigable_id, SessionHistoryEntryIdentity target_entry_identity, HistoryObjectLengthAndIndex, Vector<SessionHistoryEntryDescriptor> entries_for_navigation_api, GC::Ref<OnChangingNavigableContinuationApplied>);
diff --git a/Libraries/LibWeb/Page/Page.cpp b/Libraries/LibWeb/Page/Page.cpp
index a0cf61ade39..abbe51d3c19 100644
--- a/Libraries/LibWeb/Page/Page.cpp
+++ b/Libraries/LibWeb/Page/Page.cpp
@@ -2607,7 +2607,12 @@ void PageClient::navigation_params_creation_finished(HTML::LocalNavigable&, HTML
VERIFY_NOT_REACHED();
}
-void PageClient::history_navigation_params_creation_finished(HTML::CrossProcessId, HTML::HistoryNavigationPopulation)
+void PageClient::changing_navigable_history_job_reached_population(HTML::CrossProcessId, HTML::CrossProcessId, HTML::NavigationSourceSnapshot)
+{
+ VERIFY_NOT_REACHED();
+}
+
+void PageClient::history_navigation_params_creation_finished(HTML::CrossProcessId, HTML::CrossProcessId, HTML::NavigationPopulationResult)
{
VERIFY_NOT_REACHED();
}
diff --git a/Libraries/LibWeb/Page/Page.h b/Libraries/LibWeb/Page/Page.h
index c0ab9fa7a14..bc45956fc5b 100644
--- a/Libraries/LibWeb/Page/Page.h
+++ b/Libraries/LibWeb/Page/Page.h
@@ -712,7 +712,8 @@ public:
virtual void request_window_focus_of_remote_navigable(HTML::RemoteNavigable&) { VERIFY_NOT_REACHED(); }
virtual void request_set_opener_of_remote_navigable(HTML::RemoteNavigable&, HTML::Navigable const&) { VERIFY_NOT_REACHED(); }
virtual void navigation_params_creation_finished(HTML::LocalNavigable&, HTML::NavigationPopulationRequest, HTML::NavigationPopulationResult);
- virtual void history_navigation_params_creation_finished(HTML::CrossProcessId operation_id, HTML::HistoryNavigationPopulation);
+ virtual void changing_navigable_history_job_reached_population(HTML::CrossProcessId operation_id, HTML::CrossProcessId navigable_id, HTML::NavigationSourceSnapshot);
+ virtual void history_navigation_params_creation_finished(HTML::CrossProcessId operation_id, HTML::CrossProcessId navigable_id, HTML::NavigationPopulationResult);
virtual void navigation_population_failed(HTML::CrossProcessId, Utf16String const&) { }
virtual void page_did_create_populated_document_with_an_origin_of_its_own(HTML::CrossProcessId, HTML::CrossProcessId, HTML::PopulatedDocumentOrigin, HTML::EnvironmentId const&) { }
virtual void page_did_create_child_frame(HTML::CrossProcessId, DOM::Document const&, HTML::CrossProcessId, HTML::HostedNavigableState const&, HTML::PendingSessionHistoryEntryDescriptor const&, URL::Origin const&, HTML::EnvironmentId const&, HTML::CrossProcessId) { }
diff --git a/Libraries/LibWebView/ApplyHistoryStep.cpp b/Libraries/LibWebView/ApplyHistoryStep.cpp
index 82530d04212..0dad65b3a6b 100644
--- a/Libraries/LibWebView/ApplyHistoryStep.cpp
+++ b/Libraries/LibWebView/ApplyHistoryStep.cpp
@@ -204,8 +204,9 @@ void ApplyHistoryStep::end_changing_navigable_job(ChangingNavigable& changing_na
{
auto& navigable = changing_navigable.navigable();
changing_navigable.job_ended = true;
- if (auto population_loader = move(changing_navigable.population_loader))
+ if (auto population_loader = changing_navigable.population_loader())
population_loader->reclaim_response_body_after_failed_handoff();
+ changing_navigable.population = Empty {};
if (auto document = move(changing_navigable.populated_document))
navigable.abandon_populated_document(changing_navigable.target_entry->document_state, *document);
navigable.clear_ongoing_navigation_traversal(m_operation_id);
@@ -443,6 +444,24 @@ void ApplyHistoryStep::return_result(Web::HTML::HistoryStepResult result)
m_traversable.finish_history_operation(m_operation_id, result);
}
+// The document the job populated, or the one targetEntry's document state holds if the job's process hosts it.
+RefPtr<CanonicalDocument> ChangingNavigable::target_document(WebContentPage const& job_page) const
+{
+ if (populated_document)
+ return populated_document;
+ if (auto const& document = target_entry->document_state->document; document && document->host().ptr() == &job_page)
+ return document;
+ return {};
+}
+
+RefPtr<NavigationLoader> ChangingNavigable::population_loader() const
+{
+ return population.visit(
+ [](Empty) -> RefPtr<NavigationLoader> { return {}; },
+ [](AwaitingPopulation) -> RefPtr<NavigationLoader> { return {}; },
+ [](auto const& state) -> RefPtr<NavigationLoader> { return state.loader; });
+}
+
Web::HTML::SessionHistoryEntryDescriptor ChangingNavigable::target_entry_descriptor() const
{
auto descriptor = target_entry->descriptor();
diff --git a/Libraries/LibWebView/ApplyHistoryStep.h b/Libraries/LibWebView/ApplyHistoryStep.h
index 60f432b8464..c1dd49956ed 100644
--- a/Libraries/LibWebView/ApplyHistoryStep.h
+++ b/Libraries/LibWebView/ApplyHistoryStep.h
@@ -79,7 +79,22 @@ struct WEBVIEW_API ChangingNavigable {
// targetEntry's document, as the job left it.
Optional<Web::HTML::CrossProcessId> target_document_id;
- RefPtr<NavigationLoader> population_loader;
+ // targetEntry's document, as the job's process has it.
+ RefPtr<CanonicalDocument> target_document(WebContentPage const& job_page) const;
+
+ // Step 8 of the job, populating targetEntry's document, as its parts run across processes.
+ struct AwaitingPopulation { };
+ struct CreatingNavigationParams {
+ NonnullRefPtr<NavigationLoader> loader;
+ };
+ struct AcquiringResponseBody {
+ NonnullRefPtr<NavigationLoader> loader;
+ };
+ struct Populating {
+ NonnullRefPtr<NavigationLoader> loader;
+ };
+ Variant<Empty, AwaitingPopulation, CreatingNavigationParams, AcquiringResponseBody, Populating> population;
+ RefPtr<NavigationLoader> population_loader() const;
RefPtr<CanonicalDocument> populated_document;
private:
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cpp
index 3efc3f0651d..e1e239f0f23 100644
--- a/Libraries/LibWebView/CanonicalTraversable.cpp
+++ b/Libraries/LibWebView/CanonicalTraversable.cpp
@@ -1237,6 +1237,15 @@ RefPtr<CanonicalNavigation> CanonicalTraversable::finalized_navigation(HistoryOp
return navigation && navigation->is_finalizing() ? navigation : nullptr;
}
+Optional<Utf16String> CanonicalTraversable::finalized_navigation_id(HistoryOperation const& operation, Web::HTML::CrossProcessId navigable_id) const
+{
+ if (auto const* reload = operation.parameters.get_pointer<Web::ReloadHistoryOperationParameters>(); reload && reload->navigable_id == navigable_id)
+ return reload_navigation_id(operation.operation_id);
+ if (auto const* parameters = operation.parameters.get_pointer<Web::FinalizeCrossDocumentNavigationHistoryOperationParameters>(); parameters && parameters->navigable_id == navigable_id)
+ return parameters->navigation_id;
+ return {};
+}
+
void CanonicalTraversable::recover_from_web_content_process_crash()
{
if (has_uncommitted_navigation())
@@ -1340,29 +1349,78 @@ void CanonicalTraversable::add_history_operation_completion_endpoint(HistoryOper
operation.completion_endpoints.append(move(endpoint));
}
-void CanonicalTraversable::did_finish_history_navigation_params_creation(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryNavigationPopulation population)
+// https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step
+// 12.8. If targetEntry's document is null, or targetEntry's document state's reload pending is true:
+// NB: The process running the job reaches this after step 7, with a snapshot of navigable's active document.
+void CanonicalTraversable::did_receive_changing_navigable_history_job_reached_population(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationSourceSnapshot active_document_source_snapshot_params)
{
- auto navigable_id = population.request.navigable_id;
- auto discard = [&] { NavigationLoader::discard(source_page.client().is_private(), population.result); };
+ if (!source_page.take_owed_reply({ OwedReply::Kind::ChangingJob, operation_id, navigable_id }))
+ return;
auto* operation = find_history_operation(operation_id);
auto* changing_navigable = operation ? operation->pending_changing_job(navigable_id) : nullptr;
- if (!changing_navigable || changing_navigable->population_loader
- || !source_page.take_owed_reply({ OwedReply::Kind::ChangingJob, operation_id, navigable_id })) {
- discard();
+ if (!changing_navigable)
return;
- }
- // NB: The process populating the entry echoes its request. A file: URL in it that is not the entry's would give the
- // process a document created from another file: URL, and possibly with it local file access.
- if (population.request.history_entry.url.scheme() == "file"sv && population.request.history_entry.url != changing_navigable->target_entry->url) {
- discard();
+ if (!changing_navigable->population.has<ChangingNavigable::AwaitingPopulation>()) {
did_fail_history_navigation_population(*operation, *changing_navigable);
return;
}
- // The document's sandboxing flags are at least those the UI process snapshots for the navigable.
- population.request.target_snapshot_params.sandboxing_flags |= changing_navigable->navigable().snapshot_target_snapshot_params().sandboxing_flags;
- auto& loader = changing_navigable->population_loader;
- loader = NavigationLoader::create(source_page.client().is_private(), move(population.request));
- loader->did_finish_navigation_params_creation(move(population.result));
+ auto& navigable = changing_navigable->navigable();
+
+ // FIXME: 1. Let navTimingType be "back_forward" if targetEntry's document is null; otherwise "reload".
+
+ // 2. Let targetSnapshotParams be the result of snapshotting target snapshot params given navigable.
+ auto target_snapshot_params = navigable.snapshot_target_snapshot_params();
+
+ // 3. Let potentiallyTargetSpecificSourceSnapshotParams be sourceSnapshotParams.
+ auto potentially_target_specific_source_snapshot_params = operation->algorithm->source_snapshot_params();
+
+ // 4. If potentiallyTargetSpecificSourceSnapshotParams is null, then set it to the result of snapshotting source snapshot params given navigable's active document.
+ if (!potentially_target_specific_source_snapshot_params.has_value())
+ potentially_target_specific_source_snapshot_params = move(active_document_source_snapshot_params);
+
+ // 5. Set targetEntry's document state's reload pending to false.
+ changing_navigable->target_entry->document_state->reload_pending = false;
+ changing_navigable->target_entry->document_state->reload_bypasses_cache = false;
+ session_history_changed();
+
+ // 6. Let allowPOST be targetEntry's document state's reload pending.
+ // AD-HOC: A document another page displayed, or a crashed process lost, is loaded again with its POST
+ // resource, as the process that displayed it would have kept it.
+ auto allow_POST = changing_navigable->target_entry_reload_pending || !source_page.hosts_active_document_of(navigable);
+
+ // 7. In parallel, attempt to populate the history entry's document for targetEntry, given navigable, potentiallyTargetSpecificSourceSnapshotParams,
+ // targetSnapshotParams, userInvolvement, with allowPOST set to allowPOST and completionSteps set to
+ // queue a global task on the navigation and traversal task source given navigable's active window to
+ // run afterDocumentPopulated.
+ // NB: The process running the job creates navigationParams.
+ Web::HTML::NavigationPopulationRequest request {
+ .navigable_id = navigable_id,
+ .history_entry = Web::HTML::create_pending_session_history_entry_descriptor(changing_navigable->target_entry_descriptor()),
+ .source_snapshot_params = potentially_target_specific_source_snapshot_params.release_value(),
+ .target_snapshot_params = target_snapshot_params,
+ .csp_navigation_type = Web::ContentSecurityPolicy::Directives::NavigationType::Other,
+ .history_handling = Web::Bindings::NavigationHistoryBehavior::Replace,
+ .user_involvement = operation->algorithm->user_involvement(),
+ .navigation_id = finalized_navigation_id(*operation, navigable_id).value_or(Utf16String {}),
+ };
+ auto loader = NavigationLoader::create(source_page.client().is_private(), move(request));
+ changing_navigable->population = ChangingNavigable::CreatingNavigationParams { loader };
+ source_page.owe_reply({ OwedReply::Kind::ChangingJob, operation_id, navigable_id });
+ source_page.async_create_history_navigation_params(operation_id, loader->request(), allow_POST);
+}
+
+void CanonicalTraversable::did_finish_history_navigation_params_creation(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationPopulationResult result)
+{
+ auto* operation = find_history_operation(operation_id);
+ auto* changing_navigable = operation ? operation->pending_changing_job(navigable_id) : nullptr;
+ auto* creating = changing_navigable ? changing_navigable->population.get_pointer<ChangingNavigable::CreatingNavigationParams>() : nullptr;
+ if (!creating || !source_page.take_owed_reply({ OwedReply::Kind::ChangingJob, operation_id, navigable_id })) {
+ NavigationLoader::discard(source_page.client().is_private(), result);
+ return;
+ }
+ auto loader = creating->loader;
+ changing_navigable->population = ChangingNavigable::AcquiringResponseBody { loader };
+ loader->did_finish_navigation_params_creation(move(result));
loader->acquire_response_body([this, operation_id, navigable_id](bool succeeded) {
auto* operation = find_history_operation(operation_id);
auto* changing_navigable = operation ? operation->pending_changing_job(navigable_id) : nullptr;
@@ -1383,10 +1441,12 @@ void CanonicalTraversable::did_fail_history_navigation_population(HistoryOperati
void CanonicalTraversable::continue_history_navigation_population(HistoryOperation& operation, ChangingNavigable& changing_navigable)
{
- if (!changing_navigable.population_loader)
+ auto* acquiring = changing_navigable.population.get_pointer<ChangingNavigable::AcquiringResponseBody>();
+ if (!acquiring)
return;
RefPtr<WebContentPage> endpoint = changing_job_endpoint(changing_navigable);
- auto loader = move(changing_navigable.population_loader);
+ auto loader = acquiring->loader;
+ changing_navigable.population = Empty {};
NonnullRefPtr target_entry = *changing_navigable.target_entry;
auto operation_id = operation.operation_id;
@@ -1412,22 +1472,23 @@ void CanonicalTraversable::continue_history_navigation_population(HistoryOperati
changing_navigable.populated_document = host.document;
endpoint = host.page;
add_history_operation_completion_endpoint(operation, *endpoint);
- changing_navigable.population_loader = move(loader);
- auto finish_handoff = [this, operation_id, navigable_id, weak_loader = changing_navigable.population_loader->make_weak_ptr(), endpoint](bool succeeded) {
+ changing_navigable.population = ChangingNavigable::Populating { loader };
+ auto finish_handoff = [this, operation_id, navigable_id, weak_loader = loader->make_weak_ptr(), endpoint](bool succeeded) {
auto* operation = find_history_operation(operation_id);
auto* changing_navigable = operation ? operation->pending_changing_job(navigable_id) : nullptr;
- if (!changing_navigable || !weak_loader || changing_navigable->population_loader.ptr() != weak_loader.ptr())
+ auto* populating = changing_navigable ? changing_navigable->population.get_pointer<ChangingNavigable::Populating>() : nullptr;
+ if (!populating || !weak_loader || populating->loader.ptr() != weak_loader.ptr())
return;
if (!succeeded || !endpoint->is_open()) {
did_fail_history_navigation_population(*operation, *changing_navigable);
return;
}
- auto& loader = *changing_navigable->population_loader;
+ auto& loader = *populating->loader;
endpoint->owe_reply({ OwedReply::Kind::ChangingJob, operation_id, navigable_id });
endpoint->async_continue_history_navigation_population(operation_id, changing_navigable->target_entry_descriptor(), operation->algorithm->navigation_type(),
changing_navigable->navigable().ongoing_navigation().has<CanonicalNavigable::Traversal>(), Web::HTML::HistoryNavigationPopulation { loader.request(), loader.take_result() });
};
- changing_navigable.population_loader->move_response_body_to(endpoint->client().request_server_site_bindings(), move(finish_handoff));
+ loader->move_response_body_to(endpoint->client().request_server_site_bindings(), move(finish_handoff));
}
bool CanonicalTraversable::run_changing_navigable_history_step_job(ApplyHistoryStep& run, ChangingNavigable& changing_navigable)
@@ -1462,22 +1523,23 @@ bool CanonicalTraversable::run_changing_navigable_history_step_job(ApplyHistoryS
endpoint->begin_top_level_load(changing_navigable.target_entry->url);
}
- Optional<Utf16String> finalized_navigation_id;
- if (auto const* reload = operation.parameters.get_pointer<Web::ReloadHistoryOperationParameters>(); reload && reload->navigable_id == navigable_id)
- finalized_navigation_id = reload_navigation_id(operation.operation_id);
if (auto const* parameters = operation.parameters.get_pointer<Web::FinalizeCrossDocumentNavigationHistoryOperationParameters>(); parameters && parameters->navigable_id == navigable_id) {
- finalized_navigation_id = parameters->navigation_id;
if (auto const& populated_document = changing_navigable.target_entry->document_state->populated_document; populated_document.has_value())
changing_navigable.populated_document = populated_document->document;
}
+
+ // 8. If targetEntry's document is null, or targetEntry's document state's reload pending is true:
+ if (!changing_navigable.target_document(*endpoint) || changing_navigable.target_entry_reload_pending)
+ changing_navigable.population = ChangingNavigable::AwaitingPopulation {};
+
endpoint->owe_reply({ OwedReply::Kind::ChangingJob, operation.operation_id, navigable_id });
endpoint->async_run_changing_navigable_history_job(
operation.operation_id, navigable_id,
changing_navigable.target_entry_descriptor(), run.user_involvement(),
run.navigation_type(),
- finalized_navigation_id,
+ finalized_navigation_id(operation, navigable_id),
navigable.ongoing_navigation().has<CanonicalNavigable::Traversal>(),
- run.source_snapshot_params());
+ changing_navigable.population.has<ChangingNavigable::AwaitingPopulation>());
return true;
}
diff --git a/Libraries/LibWebView/CanonicalTraversable.h b/Libraries/LibWebView/CanonicalTraversable.h
index 7bf58e74c85..78c13715980 100644
--- a/Libraries/LibWebView/CanonicalTraversable.h
+++ b/Libraries/LibWebView/CanonicalTraversable.h
@@ -88,7 +88,8 @@ public:
Optional<Web::HTML::CrossProcessId> check_if_unloading_is_canceled(Vector<Web::HTML::CrossProcessId> navigables_that_need_before_unload, RefPtr<CanonicalSessionHistoryEntry> target_entry, Optional<Web::HTML::UserNavigationInvolvement> user_involvement_for_navigate_event, RefPtr<WebContentPage> skipped_endpoint, Web::HTML::UnloadPromptShown, Function<void(Web::HTML::CheckIfUnloadingIsCanceledResult, Web::HTML::UnloadPromptShown)> on_complete);
bool is_handing_navigable_to_another_page(CanonicalNavigable const&) const;
void did_receive_changing_navigable_history_job_ready(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition, bool update_only, Optional<Web::HTML::CrossProcessId> target_document_id);
- void did_finish_history_navigation_params_creation(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryNavigationPopulation);
+ void did_receive_changing_navigable_history_job_reached_population(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationSourceSnapshot active_document_source_snapshot_params);
+ void did_finish_history_navigation_params_creation(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationPopulationResult);
void did_receive_descendant_unload_task_complete(WebContentPage& source_page, Web::HTML::CrossProcessId unload_id, Web::HTML::CrossProcessId navigable_id);
void did_receive_child_navigable_unload_request(WebContentPage& source_page, Web::HTML::CrossProcessId navigable_id);
void did_receive_changing_navigable_continuation_applied(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Optional<Web::HTML::HostedNavigableState> activated_navigable_state, Optional<Web::HTML::SessionHistoryEntryPersistedState> previous_entry_persisted_state);
@@ -201,6 +202,7 @@ private:
HistoryOperation* find_history_operation(Web::HTML::CrossProcessId operation_id);
ApplyHistoryStep* find_history_step_run(Web::HTML::CrossProcessId operation_id);
RefPtr<CanonicalNavigation> finalized_navigation(HistoryOperation const&) const;
+ Optional<Utf16String> finalized_navigation_id(HistoryOperation const&, Web::HTML::CrossProcessId navigable_id) const;
bool update_session_history_entry_persisted_state(CanonicalNavigable&, Web::HTML::SessionHistoryEntryPersistedState const&);
void add_history_operation_completion_endpoint(HistoryOperation&, NonnullRefPtr<WebContentPage>);
void did_fail_history_navigation_population(HistoryOperation&, ChangingNavigable&);
diff --git a/Libraries/LibWebView/WebContentPage.cpp b/Libraries/LibWebView/WebContentPage.cpp
index 7c16888720c..0b05d9fc084 100644
--- a/Libraries/LibWebView/WebContentPage.cpp
+++ b/Libraries/LibWebView/WebContentPage.cpp
@@ -2193,6 +2193,11 @@ void WebContentPage::beforeunload_check_result(Web::HTML::CrossProcessId operati
traversable().did_receive_beforeunload_check_result(*this, operation_id, result, unload_prompt_shown);
}
+void WebContentPage::changing_navigable_history_job_reached_population(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationSourceSnapshot active_document_source_snapshot_params)
+{
+ traversable().did_receive_changing_navigable_history_job_reached_population(*this, operation_id, navigable_id, move(active_document_source_snapshot_params));
+}
+
void WebContentPage::changing_navigable_history_job_ready(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, bool update_only, Optional<Web::HTML::CrossProcessId> target_document_id)
{
traversable().did_receive_changing_navigable_history_job_ready(*this, operation_id, navigable_id, disposition, update_only, target_document_id);
@@ -2624,10 +2629,10 @@ void WebContentPage::did_finish_navigation_params_creation(Web::HTML::CrossProce
});
}
-void WebContentPage::did_finish_history_navigation_params_creation(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryNavigationPopulation population)
+void WebContentPage::did_finish_history_navigation_params_creation(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationPopulationResult result)
{
auto& host = this->traversable();
- host.top_level_traversable().did_finish_history_navigation_params_creation(*this, operation_id, move(population));
+ host.top_level_traversable().did_finish_history_navigation_params_creation(*this, operation_id, navigable_id, move(result));
}
void WebContentPage::did_fail_navigation_population(Web::HTML::CrossProcessId navigable_id, Utf16String navigation_id)
diff --git a/Libraries/LibWebView/WebContentPage.h b/Libraries/LibWebView/WebContentPage.h
index 9eeacb3e019..fa4658d612e 100644
--- a/Libraries/LibWebView/WebContentPage.h
+++ b/Libraries/LibWebView/WebContentPage.h
@@ -309,6 +309,7 @@ private:
virtual void request_history_operation(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters parameters) override;
virtual void revoke_history_operation(Web::HTML::CrossProcessId operation_id) override;
virtual void beforeunload_check_result(Web::HTML::CrossProcessId operation_id, Web::HTML::CheckIfUnloadingIsCanceledResult result, Web::HTML::UnloadPromptShown unload_prompt_shown) override;
+ virtual void changing_navigable_history_job_reached_population(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationSourceSnapshot active_document_source_snapshot_params) override;
virtual void changing_navigable_history_job_ready(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, bool update_only, Optional<Web::HTML::CrossProcessId> target_document_id) override;
virtual void descendant_unload_task_complete(Web::HTML::CrossProcessId unload_id, Web::HTML::CrossProcessId navigable_id) override;
virtual void request_navigable_document_abort(Web::HTML::CrossProcessId navigable_id) override;
@@ -339,7 +340,7 @@ private:
virtual void did_request_navigation_start(Web::HTML::CrossProcessId navigable_id, Web::NavigationTarget target, URL::URL url, Utf16String navigation_id, Optional<Web::HTML::NavigationStartRequest> start_request) override;
virtual void did_complete_navigation_unload_check(Web::HTML::CrossProcessId navigable_id, Utf16String navigation_id) override;
virtual void did_finish_navigation_params_creation(Web::HTML::CrossProcessId navigable_id, Utf16String navigation_id, Optional<Web::HTML::NavigationPopulationResult> result) override;
- virtual void did_finish_history_navigation_params_creation(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryNavigationPopulation population) override;
+ virtual void did_finish_history_navigation_params_creation(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationPopulationResult result) override;
virtual void did_fail_navigation_population(Web::HTML::CrossProcessId navigable_id, Utf16String navigation_id) override;
virtual void did_change_hosted_navigable_state(Web::HTML::CrossProcessId navigable_id, Web::HTML::HostedNavigableState state) override;
virtual void did_set_opener_browsing_context(Web::HTML::CrossProcessId navigable_id, Optional<Web::HTML::CrossProcessId> opener_navigable_id) override;
diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp
index 7b06a6d9d55..fd30f2a37e9 100644
--- a/Services/WebContent/ConnectionFromClient.cpp
+++ b/Services/WebContent/ConnectionFromClient.cpp
@@ -650,14 +650,14 @@ void ConnectionFromClient::continue_history_navigation_population(Web::PageId pa
if (history_executor.resume_history_navigation_population(operation_id, move(population)))
return;
auto user_involvement = population.request.user_involvement;
- history_executor.run_ui_changing_navigable_history_job(operation_id, navigable_id, move(target_entry), user_involvement, navigation_type, {}, ongoing_navigation_is_traversal, {},
+ history_executor.run_ui_changing_navigable_history_job(operation_id, navigable_id, move(target_entry), user_involvement, navigation_type, {}, ongoing_navigation_is_traversal, false,
GC::create_function(Web::HTML::main_thread_event_loop().heap(), [this, page_id, operation_id, navigable_id](Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, bool update_only, Optional<Web::HTML::CrossProcessId> target_document_id) {
async_changing_navigable_history_job_ready(page_id, operation_id, navigable_id, disposition, update_only, target_document_id);
}),
move(population));
}
-void ConnectionFromClient::run_changing_navigable_history_job(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryDescriptor target_entry, Web::HTML::UserNavigationInvolvement user_involvement, Optional<Web::Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, Optional<Web::HTML::NavigationSourceSnapshot> source_snapshot_params)
+void ConnectionFromClient::run_changing_navigable_history_job(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryDescriptor target_entry, Web::HTML::UserNavigationInvolvement user_involvement, Optional<Web::Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, bool needs_population)
{
auto page = this->page(page_id);
if (!page.has_value()) {
@@ -665,11 +665,19 @@ void ConnectionFromClient::run_changing_navigable_history_job(Web::PageId page_i
return;
}
- page->page().history_executor().run_ui_changing_navigable_history_job(operation_id, navigable_id, move(target_entry), user_involvement, navigation_type, move(finalized_navigation_id), ongoing_navigation_is_traversal, move(source_snapshot_params), GC::create_function(Web::HTML::main_thread_event_loop().heap(), [this, page_id, operation_id, navigable_id](Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, bool update_only, Optional<Web::HTML::CrossProcessId> target_document_id) {
+ page->page().history_executor().run_ui_changing_navigable_history_job(operation_id, navigable_id, move(target_entry), user_involvement, navigation_type, move(finalized_navigation_id), ongoing_navigation_is_traversal, needs_population, GC::create_function(Web::HTML::main_thread_event_loop().heap(), [this, page_id, operation_id, navigable_id](Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, bool update_only, Optional<Web::HTML::CrossProcessId> target_document_id) {
async_changing_navigable_history_job_ready(page_id, operation_id, navigable_id, disposition, update_only, target_document_id);
}));
}
+void ConnectionFromClient::create_history_navigation_params(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::NavigationPopulationRequest request, bool allow_POST)
+{
+ auto navigable_id = request.navigable_id;
+ if (auto page = this->page(page_id); page.has_value() && page->page().history_executor().create_ui_history_navigation_params(operation_id, move(request), allow_POST))
+ return;
+ async_changing_navigable_history_job_ready(page_id, operation_id, navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition::Skipped, false, {});
+}
+
void ConnectionFromClient::clear_ongoing_history_traversal(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id)
{
if (auto page = this->page(page_id); page.has_value())
diff --git a/Services/WebContent/ConnectionFromClient.h b/Services/WebContent/ConnectionFromClient.h
index e0265edd923..5df6c498f76 100644
--- a/Services/WebContent/ConnectionFromClient.h
+++ b/Services/WebContent/ConnectionFromClient.h
@@ -145,7 +145,8 @@ private:
virtual void run_beforeunload_check(Web::PageId page_id, Web::HTML::CrossProcessId check_id, Vector<Web::HTML::CrossProcessId> navigable_ids, Optional<Web::HTML::SessionHistoryEntryDescriptor> target_entry, Optional<Web::HTML::UserNavigationInvolvement> user_involvement_for_navigate_event, Web::HTML::UnloadPromptShown unload_prompt_shown) override;
virtual void discard_embedded_page(Web::PageId page_id) override;
virtual void queue_navigation_api_state_clear_task(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) override;
- virtual void run_changing_navigable_history_job(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryDescriptor target_entry, Web::HTML::UserNavigationInvolvement user_involvement, Optional<Web::Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, Optional<Web::HTML::NavigationSourceSnapshot> source_snapshot_params) override;
+ virtual void run_changing_navigable_history_job(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryDescriptor target_entry, Web::HTML::UserNavigationInvolvement user_involvement, Optional<Web::Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, bool needs_population) override;
+ virtual void create_history_navigation_params(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::NavigationPopulationRequest request, bool allow_POST) override;
virtual void clear_ongoing_history_traversal(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id) override;
virtual void apply_changing_navigable_continuation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryIdentity target_entry, u64 script_history_length, u64 script_history_index, Vector<Web::HTML::SessionHistoryEntryDescriptor> entries_for_navigation_api) override;
virtual void unload_displayed_document_and_apply_changing_navigable_continuation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryIdentity target_entry, u64 script_history_length, u64 script_history_index, Vector<Web::HTML::SessionHistoryEntryDescriptor> entries_for_navigation_api) override;
diff --git a/Services/WebContent/PageClient.cpp b/Services/WebContent/PageClient.cpp
index c06c971fd9b..9fe7d9c07d2 100644
--- a/Services/WebContent/PageClient.cpp
+++ b/Services/WebContent/PageClient.cpp
@@ -330,9 +330,14 @@ void PageClient::navigation_params_creation_finished(Web::HTML::LocalNavigable&
client().async_did_finish_navigation_params_creation(m_id, navigable.id(), request.navigation_id, move(result));
}
-void PageClient::history_navigation_params_creation_finished(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryNavigationPopulation population)
+void PageClient::changing_navigable_history_job_reached_population(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationSourceSnapshot active_document_source_snapshot_params)
{
- client().async_did_finish_history_navigation_params_creation(m_id, operation_id, move(population));
+ client().async_changing_navigable_history_job_reached_population(m_id, operation_id, navigable_id, move(active_document_source_snapshot_params));
+}
+
+void PageClient::history_navigation_params_creation_finished(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationPopulationResult result)
+{
+ client().async_did_finish_history_navigation_params_creation(m_id, operation_id, navigable_id, move(result));
}
void PageClient::navigation_population_failed(Web::HTML::CrossProcessId navigable_id, Utf16String const& navigation_id)
diff --git a/Services/WebContent/PageClient.h b/Services/WebContent/PageClient.h
index f1ebc450351..318244e3dbc 100644
--- a/Services/WebContent/PageClient.h
+++ b/Services/WebContent/PageClient.h
@@ -207,7 +207,8 @@ private:
virtual void request_window_focus_of_remote_navigable(Web::HTML::RemoteNavigable&) override;
virtual void request_set_opener_of_remote_navigable(Web::HTML::RemoteNavigable&, Web::HTML::Navigable const& opener) override;
virtual void navigation_params_creation_finished(Web::HTML::LocalNavigable&, Web::HTML::NavigationPopulationRequest, Web::HTML::NavigationPopulationResult) override;
- virtual void history_navigation_params_creation_finished(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryNavigationPopulation) override;
+ virtual void changing_navigable_history_job_reached_population(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationSourceSnapshot) override;
+ virtual void history_navigation_params_creation_finished(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationPopulationResult) override;
virtual void navigation_population_failed(Web::HTML::CrossProcessId, Utf16String const&) override;
virtual void page_did_change_hosted_navigable_state(Web::HTML::CrossProcessId navigable_id, Web::HTML::HostedNavigableState const&) override;
virtual void page_did_set_opener_browsing_context(Web::HTML::CrossProcessId navigable_id, Optional<Web::HTML::CrossProcessId> opener_navigable_id) override;
diff --git a/Services/WebContent/WebContentClient.ipc b/Services/WebContent/WebContentClient.ipc
index 8e73a1f51ce..eb1826952a1 100644
--- a/Services/WebContent/WebContentClient.ipc
+++ b/Services/WebContent/WebContentClient.ipc
@@ -98,7 +98,7 @@ endpoint WebContentClient routed by Web::PageId page_id
did_request_focusing_steps_for_navigable(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::FocusTrigger focus_trigger) =|
did_request_window_focus_of_navigable(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) =|
did_request_set_opener_of_navigable(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::CrossProcessId opener_navigable_id) =|
- did_finish_history_navigation_params_creation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryNavigationPopulation population) =|
+ did_finish_history_navigation_params_creation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationPopulationResult result) =|
did_finish_navigation_params_creation(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Utf16String navigation_id, Optional<Web::HTML::NavigationPopulationResult> result) =|
did_fail_navigation_population(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Utf16String navigation_id) =|
did_create_populated_document_with_an_origin_of_its_own(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::CrossProcessId document_id, Web::HTML::PopulatedDocumentOrigin origin, Web::HTML::EnvironmentId environment_id) =|
@@ -279,6 +279,7 @@ endpoint WebContentClient routed by Web::PageId page_id
request_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters parameters) =|
revoke_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id) =|
beforeunload_check_result(Web::PageId page_id, Web::HTML::CrossProcessId check_id, Web::HTML::CheckIfUnloadingIsCanceledResult result, Web::HTML::UnloadPromptShown unload_prompt_shown) =|
+ changing_navigable_history_job_reached_population(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::NavigationSourceSnapshot active_document_source_snapshot_params) =|
changing_navigable_history_job_ready(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, bool update_only, Optional<Web::HTML::CrossProcessId> target_document_id) =|
descendant_unload_task_complete(Web::PageId page_id, Web::HTML::CrossProcessId unload_id, Web::HTML::CrossProcessId navigable_id) =|
request_child_navigable_unload(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) =|
diff --git a/Services/WebContent/WebContentServer.ipc b/Services/WebContent/WebContentServer.ipc
index e53de9bf988..a9f43f71dde 100644
--- a/Services/WebContent/WebContentServer.ipc
+++ b/Services/WebContent/WebContentServer.ipc
@@ -126,7 +126,8 @@ endpoint WebContentServer routed by Web::PageId page_id
discard_embedded_page(Web::PageId page_id) =|
queue_navigation_api_state_clear_task(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) =|
continue_history_navigation_population(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::SessionHistoryEntryDescriptor target_entry, Optional<Web::Bindings::NavigationType> navigation_type, bool ongoing_navigation_is_traversal, Web::HTML::HistoryNavigationPopulation population) =|
- run_changing_navigable_history_job(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryDescriptor target_entry, Web::HTML::UserNavigationInvolvement user_involvement, Optional<Web::Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, Optional<Web::HTML::NavigationSourceSnapshot> source_snapshot_params) =|
+ run_changing_navigable_history_job(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryDescriptor target_entry, Web::HTML::UserNavigationInvolvement user_involvement, Optional<Web::Bindings::NavigationType> navigation_type, Optional<Utf16String> finalized_navigation_id, bool ongoing_navigation_is_traversal, bool needs_population) =|
+ create_history_navigation_params(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::NavigationPopulationRequest request, bool allow_POST) =|
clear_ongoing_history_traversal(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id) =|
apply_changing_navigable_continuation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryIdentity target_entry, u64 script_history_length, u64 script_history_index, Vector<Web::HTML::SessionHistoryEntryDescriptor> entries_for_navigation_api) =|
unload_displayed_document_and_apply_changing_navigable_continuation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::SessionHistoryEntryIdentity target_entry, u64 script_history_length, u64 script_history_index, Vector<Web::HTML::SessionHistoryEntryDescriptor> entries_for_navigation_api) =|