Skip to content

Truly independent web browser

LibWeb+LibWebView+WebContent: Revoke an aborted traversal's resumption

Shannon Boothdee9684212da
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.cpp b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
index e458230522f..c117a25b821 100644
--- a/Libraries/LibWeb/HTML/HistoryExecutor.cpp
+++ b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
@@ -70,7 +70,6 @@ void HistoryExecutor::visit_edges(Cell::Visitor& visitor)
for (auto& operation : m_history_operations) {
visitor.visit(operation.value.source_snapshot_params);
visitor.visit(operation.value.pending_document);
- visitor.visit(operation.value.pre_steps);
visitor.visit(operation.value.on_apply_complete);
visitor.visit(operation.value.on_complete);
for (auto& population : operation.value.pending_populations)
@@ -93,31 +92,23 @@ HistoryExecutor::HistoryOperationState& HistoryExecutor::ensure_history_operatio
return m_history_operations.ensure(operation_id);
}
-void HistoryExecutor::request_history_operation(HistoryOperationParameters parameters)
+CrossProcessId HistoryExecutor::request_history_operation(HistoryOperationParameters parameters)
{
- request_history_operation(move(parameters), {});
+ return request_history_operation(move(parameters), {});
}
-void HistoryExecutor::request_history_operation(HistoryOperationParameters parameters, HistoryOperationState state)
+CrossProcessId HistoryExecutor::request_history_operation(HistoryOperationParameters parameters, HistoryOperationState state)
{
auto operation_id = m_page->client().allocate_cross_process_id();
m_history_operations.set(operation_id, move(state));
m_page->client().page_did_request_history_operation(operation_id, move(parameters));
+ return operation_id;
}
-void HistoryExecutor::handle_ui_history_operation_started(CrossProcessId operation_id, GC::Ref<OnHistoryOperationReady> ready)
+void HistoryExecutor::revoke_history_operation(CrossProcessId operation_id)
{
- auto* operation = find_history_operation(operation_id);
- if (!operation) {
- ready->function()(HistoryStepResult::Applied);
- return;
- }
-
- if (operation->pre_steps) {
- operation->pre_steps->function()(ready);
- return;
- }
- ready->function()(Empty {});
+ if (m_history_operations.contains(operation_id))
+ m_page->client().page_did_revoke_history_operation(operation_id);
}
void HistoryExecutor::complete_ui_history_operation(CrossProcessId operation_id, HistoryStepResult result, Optional<i32> target_entry_step)
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.h b/Libraries/LibWeb/HTML/HistoryExecutor.h
index 592b4e007f0..d8eb709efb6 100644
--- a/Libraries/LibWeb/HTML/HistoryExecutor.h
+++ b/Libraries/LibWeb/HTML/HistoryExecutor.h
@@ -41,15 +41,12 @@ class WEB_API HistoryExecutor final : public GC::Cell {
GC_DECLARE_ALLOCATOR(HistoryExecutor);
public:
- using OnHistoryOperationReady = GC::Function<void(Web::HistoryOperationReadyResult)>;
- using OnHistoryOperationPreSteps = GC::Function<void(GC::Ref<OnHistoryOperationReady>)>;
struct HistoryOperationState {
GC::Ptr<DOM::Document> pending_document {};
GC::Ptr<SourceSnapshotParams> source_snapshot_params {};
Optional<NavigationSourceSnapshot> serialized_source_snapshot_params {};
Optional<CrossProcessId> local_target_navigable_id {};
RefPtr<SessionHistoryEntry> local_target_entry {};
- GC::Ptr<OnHistoryOperationPreSteps> pre_steps {};
GC::Ptr<OnApplyHistoryStepComplete> on_apply_complete {};
GC::Ptr<OnApplyHistoryStepComplete> on_complete {};
@@ -59,9 +56,10 @@ public:
HashMap<CrossProcessId, GC::Ref<GC::Function<void(HistoryNavigationPopulation)>>> pending_populations {};
};
- void request_history_operation(HistoryOperationParameters);
- void request_history_operation(HistoryOperationParameters, HistoryOperationState);
- void handle_ui_history_operation_started(CrossProcessId operation_id, GC::Ref<OnHistoryOperationReady>);
+ CrossProcessId request_history_operation(HistoryOperationParameters);
+ CrossProcessId request_history_operation(HistoryOperationParameters, HistoryOperationState);
+ // Takes back a requested operation the UI process has not started.
+ void revoke_history_operation(CrossProcessId operation_id);
void complete_ui_history_operation(CrossProcessId operation_id, HistoryStepResult, Optional<i32> target_entry_step);
void traverse_the_history_by_delta(int delta, GC::Ptr<DOM::Document> source_document = {});
diff --git a/Libraries/LibWeb/HTML/NavigateEvent.h b/Libraries/LibWeb/HTML/NavigateEvent.h
index 91162f79db8..2f79218863e 100644
--- a/Libraries/LibWeb/HTML/NavigateEvent.h
+++ b/Libraries/LibWeb/HTML/NavigateEvent.h
@@ -16,6 +16,7 @@
#include <LibWeb/HTML/StructuredSerializeTypes.h>
#include <LibWeb/WebIDL/CallbackType.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
+#include <LibWebCommon/HTML/CrossProcessId.h>
#include <LibWebCommon/HighResolutionTime/DOMHighResTimeStamp.h>
namespace Web::Bindings {
@@ -114,11 +115,13 @@ public:
Vector<NavigationInterceptHandler> const& navigation_handler_list() const { return m_navigation_handler_list; }
Optional<StorageSerializationRecord> classic_history_api_state() const { return m_classic_history_api_state; }
bool has_started_navigate_event_intercept_commit_handler_steps() const { return m_has_started_navigate_event_intercept_commit_handler_steps; }
+ Optional<CrossProcessId> resume_traversal_operation_id() const { return m_resume_traversal_operation_id; }
void set_abort_controller(GC::Ref<DOM::AbortController> c) { m_abort_controller = c; }
void set_interception_state(InterceptionState s) { m_interception_state = s; }
void set_classic_history_api_state(Optional<StorageSerializationRecord> r) { m_classic_history_api_state = move(r); }
void set_has_started_navigate_event_intercept_commit_handler_steps() { m_has_started_navigate_event_intercept_commit_handler_steps = true; }
+ void set_resume_traversal_operation_id(CrossProcessId id) { m_resume_traversal_operation_id = id; }
void finish(bool did_fulfill);
@@ -141,6 +144,9 @@ private:
bool m_has_started_navigate_event_intercept_commit_handler_steps { false };
+ // The history operation resuming this intercepted traverse, which is revoked if the event is aborted first.
+ Optional<CrossProcessId> m_resume_traversal_operation_id;
+
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigateevent-navigation-handler-list
Vector<NavigationInterceptHandler> m_navigation_handler_list;
diff --git a/Libraries/LibWeb/HTML/Navigation.cpp b/Libraries/LibWeb/HTML/Navigation.cpp
index 6fb1230ab1c..c60fe75d2bd 100644
--- a/Libraries/LibWeb/HTML/Navigation.cpp
+++ b/Libraries/LibWeb/HTML/Navigation.cpp
@@ -814,6 +814,10 @@ void Navigation::abort_a_navigate_event(GC::Ref<NavigateEvent> event, JS::Value
// 2. Set navigation's ongoing navigate event to null.
m_ongoing_navigate_event = nullptr;
+ // AD-HOC: An aborted intercepted traverse must not be resumed. See https://github.com/whatwg/html/issues/12362.
+ if (auto operation_id = event->resume_traversal_operation_id(); operation_id.has_value())
+ window().page().history_executor().revoke_history_operation(*operation_id);
+
// 5. If navigation's ongoing API method tracker is non-null, then reject the finished promise for apiMethodTracker
// with reason.
// AD-HOC: This runs before signaling abort, since an abort handler can start a new navigation. Its inner navigate
@@ -1347,24 +1351,12 @@ void Navigation::commit_a_navigate_event(GC::Ref<NavigateEvent> event, GC::Ptr<N
auto destination_entry = event->destination()->navigation_history_entry();
VERIFY(destination_entry);
auto target_step = destination_entry->session_history_entry().step().get<int>();
- navigable->page().history_executor().request_history_operation(
- ResumeTraverseHistoryOperationParameters {
- .navigable_id = navigable->id(),
- .target_step = target_step,
- .user_involvement = user_involvement_for_resume,
- },
- {
- .pre_steps = GC::create_function(heap(), [this, event](GC::Ref<HistoryExecutor::OnHistoryOperationReady> ready) {
- // NB: This operation can start after a later navigation has aborted the intercepted
- // traverse. In that case, the aborted traverse must not be resumed.
- // See https://github.com/whatwg/html/issues/12362.
- if (event->abort_controller()->signal()->aborted() || event != m_ongoing_navigate_event) {
- ready->function()(HistoryStepResult::Applied);
- return;
- }
- ready->function()(Empty {});
- }),
- });
+ auto operation_id = navigable->page().history_executor().request_history_operation(ResumeTraverseHistoryOperationParameters {
+ .navigable_id = navigable->id(),
+ .target_step = target_step,
+ .user_involvement = user_involvement_for_resume,
+ });
+ event->set_resume_traversal_operation_id(operation_id);
}
// - "push"
diff --git a/Libraries/LibWeb/Page/Page.h b/Libraries/LibWeb/Page/Page.h
index 8ea7f404c4b..ab788508e02 100644
--- a/Libraries/LibWeb/Page/Page.h
+++ b/Libraries/LibWeb/Page/Page.h
@@ -771,6 +771,7 @@ public:
virtual bool page_did_request_register_session_store_tab_for_testing() { return false; }
virtual String page_did_request_session_store_tab_state_for_testing() { return "{}"_string; }
virtual void page_did_request_history_operation([[maybe_unused]] HTML::CrossProcessId operation_id, [[maybe_unused]] HistoryOperationParameters parameters) { }
+ virtual void page_did_revoke_history_operation([[maybe_unused]] HTML::CrossProcessId operation_id) { }
virtual void page_did_request_child_navigable_unload([[maybe_unused]] HTML::CrossProcessId navigable_id) { }
virtual void page_did_request_remote_document_abort([[maybe_unused]] HTML::CrossProcessId navigable_id) { }
virtual void page_did_request_remote_document_unfullscreen([[maybe_unused]] HTML::CrossProcessId navigable_id) { }
diff --git a/Libraries/LibWebCommon/HTML/HistoryOperation.h b/Libraries/LibWebCommon/HTML/HistoryOperation.h
index aeb00058068..68d55848cb9 100644
--- a/Libraries/LibWebCommon/HTML/HistoryOperation.h
+++ b/Libraries/LibWebCommon/HTML/HistoryOperation.h
@@ -32,8 +32,6 @@ struct FinalizeCrossDocumentNavigationHistoryOperationParameters {
Optional<HTML::CrossProcessId> document_id;
};
-using HistoryOperationReadyResult = Variant<Empty, HTML::HistoryStepResult>;
-
struct ReloadHistoryOperationParameters {
HTML::CrossProcessId navigable_id;
HTML::UserNavigationInvolvement user_involvement;
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cpp
index c362a444705..7e729e4b149 100644
--- a/Libraries/LibWebView/CanonicalTraversable.cpp
+++ b/Libraries/LibWebView/CanonicalTraversable.cpp
@@ -2044,8 +2044,8 @@ ApplyHistoryStepJobs CanonicalTraversable::create_apply_history_step_jobs(Histor
void CanonicalTraversable::run_history_operation_at_queue_position(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters request, RefPtr<WebContentPage> requesting_page, u64 sequence_number, RefPtr<CanonicalSessionHistoryEntry> target_entry, OnHistoryOperationComplete on_complete, NonnullRefPtr<Core::Promise<Empty>> promise)
{
- // The traversal queue can outlive an embedded page which appended work to it. Such a page cannot run the
- // preparation step or receive completion, so discard its queued operation instead of waiting forever.
+ // The traversal queue can outlive an embedded page which appended work to it. Such a page cannot receive
+ // completion, so discard its queued operation instead of waiting forever.
if (requesting_page && !requesting_page->is_open()) {
if (auto const* parameters = request.get_pointer<Web::FinalizeCrossDocumentNavigationHistoryOperationParameters>()) {
if (auto navigable = find(parameters->navigable_id); navigable.has_value())
@@ -2237,6 +2237,11 @@ void CanonicalTraversable::enqueue_history_operation(Web::HTML::CrossProcessId o
}
}
+ // A page that aborts an intercepted traverse before its resumption runs revokes the resumption.
+ Optional<SessionHistoryTraversalQueue::RevocableOperation> revocable_operation;
+ if (request.has<Web::ResumeTraverseHistoryOperationParameters>() && requesting_page)
+ revocable_operation = SessionHistoryTraversalQueue::RevocableOperation { requesting_page->id(), operation_id };
+
auto steps = [this, operation_id, request = move(request), requesting_page = move(requesting_page), sequence_number, target_entry, on_complete = move(on_complete)](NonnullRefPtr<Core::Promise<Empty>> promise) mutable {
run_history_operation_at_queue_position(operation_id, move(request), move(requesting_page), sequence_number, move(target_entry), move(on_complete), move(promise));
};
@@ -2244,7 +2249,15 @@ void CanonicalTraversable::enqueue_history_operation(Web::HTML::CrossProcessId o
if (synchronous_navigation_target.has_value())
m_history_traversal_queue.append_session_history_synchronous_navigation_steps(*synchronous_navigation_target, move(target_entry), move(steps));
else
- m_history_traversal_queue.append_session_history_traversal_steps(move(steps));
+ m_history_traversal_queue.append_session_history_traversal_steps(move(steps), revocable_operation);
+}
+
+void CanonicalTraversable::revoke_history_operation(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id)
+{
+ // Steps that have started run to completion.
+ if (!m_history_traversal_queue.remove_steps_of_revoked_operation({ source_page.id(), operation_id }))
+ return;
+ source_page.async_complete_history_operation(operation_id, Web::HTML::HistoryStepResult::Applied, {}, m_session_history.size());
}
void CanonicalTraversable::enqueue_browser_history_traversal(Web::TraverseToStepHistoryOperationParameters parameters, bool check_for_cancelation, OnHistoryOperationComplete on_complete)
@@ -2325,13 +2338,6 @@ void CanonicalTraversable::update_for_navigable_creation_or_destruction(HistoryO
apply_history_step(operation, *step, false, {}, Web::HTML::UserNavigationInvolvement::None, {});
}
-// Resuming a traversal begins, at its queue position, with steps in the requesting process, which can find the
-// intercepted navigate event aborted there. The other operations have their complete input in canonical state.
-static bool history_operation_needs_preparation(Web::HistoryOperationParameters const& parameters)
-{
- return parameters.has<Web::ResumeTraverseHistoryOperationParameters>();
-}
-
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#traverse-the-history-by-a-delta
void CanonicalTraversable::traverse_the_history_by_a_delta_at_queue_position(HistoryOperation& operation, Web::TraverseByDeltaHistoryOperationParameters const& request)
{
@@ -2499,7 +2505,7 @@ void CanonicalTraversable::finalize_a_same_document_navigation(HistoryOperation&
apply_the_push_or_replace_history_step(operation, *target_step, request.history_handling, request.user_involvement);
}
-void CanonicalTraversable::run_direct_history_operation(HistoryOperation& operation)
+void CanonicalTraversable::run_history_operation(HistoryOperation& operation)
{
operation.parameters.visit(
[&](Web::ReloadHistoryOperationParameters const& parameters) {
@@ -2585,6 +2591,9 @@ void CanonicalTraversable::run_direct_history_operation(HistoryOperation& operat
// Flush is a queue barrier; completing at the queue position is the whole operation.
finish_history_operation(operation.operation_id, Web::HTML::HistoryStepResult::Applied, {});
},
+ [&](Web::ResumeTraverseHistoryOperationParameters const& parameters) {
+ resume_applying_the_traverse_history_step(operation, parameters.target_step, parameters.user_involvement);
+ },
[&](Web::FinalizeCrossDocumentNavigationHistoryOperationParameters const&) {
// A navigation that ended before its completion steps appended this has nothing to finalize.
auto navigation = finalized_navigation(operation);
@@ -2593,9 +2602,6 @@ void CanonicalTraversable::run_direct_history_operation(HistoryOperation& operat
return;
}
finalize_a_cross_document_navigation(operation);
- },
- [&](auto const&) {
- VERIFY_NOT_REACHED();
});
}
@@ -2618,17 +2624,7 @@ void CanonicalTraversable::start_history_operation(HistoryOperation& operation,
if (operation.initiating_page)
add_history_operation_completion_endpoint(operation, *operation.initiating_page);
- if (!history_operation_needs_preparation(operation.parameters)) {
- run_direct_history_operation(operation);
- return;
- }
-
- if (!operation.initiating_page) {
- finish_history_operation(operation.operation_id, Web::HTML::HistoryStepResult::CanceledByMissingPage, {});
- return;
- }
-
- operation.initiating_page->async_history_operation_started(operation.operation_id);
+ run_history_operation(operation);
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-cross-document-navigation
@@ -2751,20 +2747,6 @@ void CanonicalTraversable::finalize_a_cross_document_navigation(HistoryOperation
apply_the_push_or_replace_history_step(operation, *target_step, parameters.history_handling, parameters.user_involvement);
}
-void CanonicalTraversable::did_receive_history_operation_ready(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HistoryOperationReadyResult result)
-{
- auto* operation = find_history_operation(operation_id);
- if (!operation || operation->algorithm || !history_operation_needs_preparation(operation->parameters) || !operation->was_initiated_by(source_page))
- return;
- if (auto const* step_result = result.get_pointer<Web::HTML::HistoryStepResult>()) {
- finish_history_operation(operation_id, *step_result, {});
- return;
- }
-
- auto const& parameters = operation->parameters.get<Web::ResumeTraverseHistoryOperationParameters>();
- resume_applying_the_traverse_history_step(*operation, parameters.target_step, parameters.user_involvement);
-}
-
void CanonicalTraversable::finish_history_operation(Web::HTML::CrossProcessId operation_id, Web::HTML::HistoryStepResult result, Optional<i32> committed_step)
{
auto operation = m_history_operations.take(operation_id);
diff --git a/Libraries/LibWebView/CanonicalTraversable.h b/Libraries/LibWebView/CanonicalTraversable.h
index 153bf60012c..d4b81514d55 100644
--- a/Libraries/LibWebView/CanonicalTraversable.h
+++ b/Libraries/LibWebView/CanonicalTraversable.h
@@ -77,7 +77,7 @@ public:
RefPtr<WebContentPage> page_hosting(CanonicalNavigable const&) const;
- void did_receive_history_operation_ready(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id, Web::HistoryOperationReadyResult);
+ void revoke_history_operation(WebContentPage& source_page, Web::HTML::CrossProcessId operation_id);
void did_receive_beforeunload_check_result(WebContentPage& source_page, Web::HTML::CrossProcessId check_id, Web::HTML::CheckIfUnloadingIsCanceledResult, Web::HTML::UnloadPromptShown);
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#checking-if-unloading-is-canceled
@@ -212,7 +212,7 @@ private:
void complete_descendant_unload_task(Web::HTML::CrossProcessId unload_id, Web::HTML::CrossProcessId navigable_id);
[[nodiscard]] Function<void()> end_changing_navigable_history_step_job(HistoryOperation&, Web::HTML::CrossProcessId navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition);
ApplyHistoryStepJobs create_apply_history_step_jobs(HistoryOperation&);
- void run_direct_history_operation(HistoryOperation&);
+ void run_history_operation(HistoryOperation&);
void traverse_the_history_by_a_delta_at_queue_position(HistoryOperation&, Web::TraverseByDeltaHistoryOperationParameters const&);
void perform_a_navigation_api_traversal_at_queue_position(HistoryOperation&, Web::NavigationAPITraverseHistoryOperationParameters const&);
void finalize_a_same_document_navigation(HistoryOperation&, Web::FinalizeSameDocumentNavigationHistoryOperationParameters const&);
diff --git a/Libraries/LibWebView/SessionHistoryTraversalQueue.cpp b/Libraries/LibWebView/SessionHistoryTraversalQueue.cpp
index 832d879c4b2..45b9f3299ae 100644
--- a/Libraries/LibWebView/SessionHistoryTraversalQueue.cpp
+++ b/Libraries/LibWebView/SessionHistoryTraversalQueue.cpp
@@ -10,15 +10,22 @@
namespace WebView {
-void SessionHistoryTraversalQueue::append_session_history_traversal_steps(SessionHistoryTraversalSteps steps)
+void SessionHistoryTraversalQueue::append_session_history_traversal_steps(SessionHistoryTraversalSteps steps, Optional<RevocableOperation> revocable_operation)
{
- m_algorithm_set.append({ {}, move(steps), ++m_last_enqueued_sequence_number, {} });
+ m_algorithm_set.append({ {}, move(steps), ++m_last_enqueued_sequence_number, {}, revocable_operation });
schedule_processing();
}
+bool SessionHistoryTraversalQueue::remove_steps_of_revoked_operation(RevocableOperation const& operation)
+{
+ return m_algorithm_set.remove_first_matching([&](auto const& item) {
+ return item.revocable_operation == operation;
+ });
+}
+
void SessionHistoryTraversalQueue::append_session_history_synchronous_navigation_steps(Web::HTML::CrossProcessId target_navigable, RefPtr<CanonicalSessionHistoryEntry> target_entry, SessionHistoryTraversalSteps steps)
{
- m_algorithm_set.append({ target_navigable, move(steps), ++m_last_enqueued_sequence_number, move(target_entry) });
+ m_algorithm_set.append({ target_navigable, move(steps), ++m_last_enqueued_sequence_number, move(target_entry), {} });
schedule_processing();
}
diff --git a/Libraries/LibWebView/SessionHistoryTraversalQueue.h b/Libraries/LibWebView/SessionHistoryTraversalQueue.h
index fea84e3dcf9..2bf01e893fd 100644
--- a/Libraries/LibWebView/SessionHistoryTraversalQueue.h
+++ b/Libraries/LibWebView/SessionHistoryTraversalQueue.h
@@ -14,6 +14,7 @@
#include <AK/WeakPtr.h>
#include <LibCore/Promise.h>
#include <LibWebCommon/HTML/CrossProcessId.h>
+#include <LibWebCommon/Page/PageId.h>
#include <LibWebView/Export.h>
namespace WebView {
@@ -34,6 +35,14 @@ public:
SessionHistoryTraversalQueue() = default;
+ // The operation a page requested and can revoke while its steps have not run.
+ struct RevocableOperation {
+ Web::PageId page_id;
+ Web::HTML::CrossProcessId operation_id;
+
+ bool operator==(RevocableOperation const&) const = default;
+ };
+
struct Item {
// Present for synchronous navigation steps, empty for plain algorithm steps.
Optional<Web::HTML::CrossProcessId> target_navigable;
@@ -41,10 +50,12 @@ public:
u64 sequence_number { 0 };
// The entry synchronous navigation steps finalize.
RefPtr<CanonicalSessionHistoryEntry> target_entry;
+ Optional<RevocableOperation> revocable_operation;
};
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#tn-append-session-history-traversal-steps
- void append_session_history_traversal_steps(SessionHistoryTraversalSteps);
+ void append_session_history_traversal_steps(SessionHistoryTraversalSteps, Optional<RevocableOperation> = {});
+ bool remove_steps_of_revoked_operation(RevocableOperation const&);
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#tn-append-session-history-sync-nav-steps
void append_session_history_synchronous_navigation_steps(Web::HTML::CrossProcessId target_navigable, RefPtr<CanonicalSessionHistoryEntry> target_entry, SessionHistoryTraversalSteps);
diff --git a/Libraries/LibWebView/WebContentPage.cpp b/Libraries/LibWebView/WebContentPage.cpp
index 52afd763bec..bd301a3a230 100644
--- a/Libraries/LibWebView/WebContentPage.cpp
+++ b/Libraries/LibWebView/WebContentPage.cpp
@@ -1622,9 +1622,9 @@ void WebContentPage::request_history_operation(Web::HTML::CrossProcessId operati
view().request_history_operation({}, *this, operation_id, move(parameters));
}
-void WebContentPage::history_operation_ready(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationReadyResult result)
+void WebContentPage::revoke_history_operation(Web::HTML::CrossProcessId operation_id)
{
- traversable().did_receive_history_operation_ready(*this, operation_id, move(result));
+ traversable().revoke_history_operation(*this, operation_id);
}
void WebContentPage::beforeunload_check_result(Web::HTML::CrossProcessId operation_id, Web::HTML::CheckIfUnloadingIsCanceledResult result, Web::HTML::UnloadPromptShown unload_prompt_shown)
diff --git a/Libraries/LibWebView/WebContentPage.h b/Libraries/LibWebView/WebContentPage.h
index 0fe7977707d..5d0d60a1559 100644
--- a/Libraries/LibWebView/WebContentPage.h
+++ b/Libraries/LibWebView/WebContentPage.h
@@ -265,7 +265,7 @@ private:
virtual void did_change_focused_navigable(Web::HTML::CrossProcessId navigable_id) override;
virtual void did_request_key_event_for_testing(Web::KeyEvent event) override;
virtual void request_history_operation(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters parameters) override;
- virtual void history_operation_ready(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationReadyResult result) 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_ready(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, Web::HTML::UnloadDisplayedDocument unload_displayed_document) override;
virtual void changing_navigable_unload_preparation_complete(Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id) override;
diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp
index efabb5c43f0..b1311c71101 100644
--- a/Services/WebContent/ConnectionFromClient.cpp
+++ b/Services/WebContent/ConnectionFromClient.cpp
@@ -536,19 +536,6 @@ void ConnectionFromClient::cancel_download(Web::PageId page_id, u64 download_id)
page->cancel_download(download_id);
}
-void ConnectionFromClient::history_operation_started(Web::PageId page_id, Web::HTML::CrossProcessId operation_id)
-{
- auto page = this->page(page_id);
- if (!page.has_value()) {
- async_history_operation_ready(page_id, operation_id, Web::HTML::HistoryStepResult::CanceledByMissingPage);
- return;
- }
-
- page->page().history_executor().handle_ui_history_operation_started(operation_id, GC::create_function(Web::HTML::main_thread_event_loop().heap(), [this, page_id, operation_id](Web::HistoryOperationReadyResult result) {
- async_history_operation_ready(page_id, operation_id, move(result));
- }));
-}
-
void ConnectionFromClient::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)
{
auto page = this->page(page_id);
diff --git a/Services/WebContent/ConnectionFromClient.h b/Services/WebContent/ConnectionFromClient.h
index 879b75cacbb..bee873ab7e0 100644
--- a/Services/WebContent/ConnectionFromClient.h
+++ b/Services/WebContent/ConnectionFromClient.h
@@ -139,7 +139,6 @@ private:
virtual void discard_provisional_navigable(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) override;
virtual void stop_hosting_navigable(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ReplicatedNavigableState) override;
virtual void set_hosted_root_viewport(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Web::DevicePixelSize, Web::DevicePixelRect viewport_intersection, double device_pixel_ratio) override;
- virtual void history_operation_started(Web::PageId page_id, Web::HTML::CrossProcessId operation_id) override;
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 operation_id, Web::HTML::CrossProcessId navigable_id) override;
diff --git a/Services/WebContent/PageClient.cpp b/Services/WebContent/PageClient.cpp
index a8351dbb9fb..e3bc61ea6c3 100644
--- a/Services/WebContent/PageClient.cpp
+++ b/Services/WebContent/PageClient.cpp
@@ -1647,6 +1647,11 @@ void PageClient::page_did_request_history_operation(Web::HTML::CrossProcessId op
client().async_request_history_operation(m_id, operation_id, move(parameters));
}
+void PageClient::page_did_revoke_history_operation(Web::HTML::CrossProcessId operation_id)
+{
+ client().async_revoke_history_operation(m_id, operation_id);
+}
+
void PageClient::page_did_request_child_navigable_unload(Web::HTML::CrossProcessId navigable_id)
{
client().async_request_child_navigable_unload(m_id, navigable_id);
diff --git a/Services/WebContent/PageClient.h b/Services/WebContent/PageClient.h
index 64fd6685ace..0187880d995 100644
--- a/Services/WebContent/PageClient.h
+++ b/Services/WebContent/PageClient.h
@@ -307,6 +307,7 @@ private:
virtual void page_did_request_webdriver_mouse_event(Web::HTML::CrossProcessId local_root_id, Web::MouseEvent, GC::Ref<GC::Function<void()>> on_handled) override;
virtual void page_did_request_set_system_visibility_state(Web::HTML::VisibilityState) override;
virtual void page_did_request_history_operation(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters) override;
+ virtual void page_did_revoke_history_operation(Web::HTML::CrossProcessId operation_id) override;
virtual void page_did_request_child_navigable_unload(Web::HTML::CrossProcessId navigable_id) override;
virtual void page_did_request_remote_document_abort(Web::HTML::CrossProcessId navigable_id) override;
virtual void page_did_request_remote_document_unfullscreen(Web::HTML::CrossProcessId navigable_id) override;
diff --git a/Services/WebContent/WebContentClient.ipc b/Services/WebContent/WebContentClient.ipc
index 478959a4296..cdbdc55ffa0 100644
--- a/Services/WebContent/WebContentClient.ipc
+++ b/Services/WebContent/WebContentClient.ipc
@@ -245,7 +245,7 @@ endpoint WebContentClient routed by Web::PageId page_id
did_request_webdriver_mouse_event(Web::PageId page_id, u64 request_id, Web::HTML::CrossProcessId local_root_id, Web::MouseEvent event) =|
did_request_set_system_visibility_state(Web::PageId page_id, Web::HTML::VisibilityState visibility_state) =|
request_history_operation(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters parameters) =|
- history_operation_ready(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HistoryOperationReadyResult result) =|
+ 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_ready(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ChangingNavigableHistoryStepJobDisposition disposition, Web::HTML::UnloadDisplayedDocument unload_displayed_document) =|
changing_navigable_unload_preparation_complete(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id) =|
diff --git a/Services/WebContent/WebContentServer.ipc b/Services/WebContent/WebContentServer.ipc
index b2f7233e1e3..21e411a250e 100644
--- a/Services/WebContent/WebContentServer.ipc
+++ b/Services/WebContent/WebContentServer.ipc
@@ -112,7 +112,6 @@ endpoint WebContentServer routed by Web::PageId page_id
discard_provisional_navigable(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id) =|
stop_hosting_navigable(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Web::HTML::ReplicatedNavigableState replicated_state) =|
set_hosted_root_viewport(Web::PageId page_id, Web::HTML::CrossProcessId navigable_id, Web::DevicePixelSize size, Web::DevicePixelRect viewport_intersection, double device_pixel_ratio) =|
- history_operation_started(Web::PageId page_id, Web::HTML::CrossProcessId operation_id) =|
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) =|
discard_embedded_page(Web::PageId page_id) =|
queue_navigation_api_state_clear_task(Web::PageId page_id, Web::HTML::CrossProcessId operation_id, Web::HTML::CrossProcessId navigable_id) =|