Use the LibWebView history mirror to preserve traversable session history across WebContent process swaps. WebContent reports snapshots to the UI process, and new renderers can be seeded from the mirror. Browser back and forward now resolve through the UI-owned used history steps. WebContent still runs the spec traversal path when the current renderer has enough matching state to do so. Handle canceled and no-op UI navigations without leaving speculative history entries or pending WebDriver waits behind. Preserve traversal precheck state across synchronous IPC shutdown, and avoid overwriting a restored target entry's persisted scroll state before the document has adopted that entry.
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2022-2024, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibIPC/ConnectionFromClient.h>
|
|
#include <LibIPC/Transport.h>
|
|
#include <WebContent/WebDriverClientEndpoint.h>
|
|
#include <WebContent/WebDriverServerEndpoint.h>
|
|
|
|
namespace WebDriver {
|
|
|
|
class Client;
|
|
|
|
class WebContentConnection
|
|
: public IPC::ConnectionFromClient<WebDriverClientEndpoint, WebDriverServerEndpoint> {
|
|
C_OBJECT_ABSTRACT(WebContentConnection)
|
|
public:
|
|
explicit WebContentConnection(NonnullOwnPtr<IPC::Transport> transport);
|
|
|
|
Web::WebDriver::Response wait_for_navigation_completion()
|
|
{
|
|
auto response = send_sync_but_allow_failure<Messages::WebDriverClient::WaitForNavigationCompletion>();
|
|
VERIFY(response);
|
|
return response->response();
|
|
}
|
|
|
|
Function<void()> on_close;
|
|
Function<void(Web::WebDriver::Response)> on_driver_execution_complete;
|
|
Function<void(String)> on_did_set_window_handle;
|
|
Function<void(String)> on_did_start_window_replacement;
|
|
Function<void(String)> on_did_close_window;
|
|
|
|
private:
|
|
virtual void die() override;
|
|
|
|
virtual void driver_execution_complete(Web::WebDriver::Response) override;
|
|
virtual void did_set_window_handle(String) override;
|
|
virtual void did_start_window_replacement(String) override;
|
|
virtual void did_close_window(String) override;
|
|
};
|
|
|
|
}
|