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.
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2022-2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/EnumBits.h>
|
|
#include <AK/Forward.h>
|
|
#include <AK/StringView.h>
|
|
#include <LibWeb/Export.h>
|
|
#include <LibWeb/WebDriver/Response.h>
|
|
|
|
namespace Web::WebDriver {
|
|
|
|
enum class SessionFlags {
|
|
Default = 0x0,
|
|
Http = 0x1,
|
|
};
|
|
AK_ENUM_BITWISE_OPERATORS(SessionFlags);
|
|
|
|
// https://w3c.github.io/webdriver/#dfn-page-load-strategy
|
|
enum class PageLoadStrategy {
|
|
None,
|
|
Eager,
|
|
Normal,
|
|
};
|
|
|
|
constexpr PageLoadStrategy page_load_strategy_from_string(StringView strategy)
|
|
{
|
|
if (strategy == "none"sv)
|
|
return PageLoadStrategy::None;
|
|
if (strategy == "eager"sv)
|
|
return PageLoadStrategy::Eager;
|
|
if (strategy == "normal"sv)
|
|
return PageLoadStrategy::Normal;
|
|
VERIFY_NOT_REACHED();
|
|
}
|
|
|
|
enum class InterfaceMode {
|
|
Graphical,
|
|
Headless,
|
|
};
|
|
WEB_API void set_default_interface_mode(InterfaceMode);
|
|
|
|
struct WEB_API LadybirdOptions {
|
|
explicit LadybirdOptions(JsonObject const& capabilities);
|
|
|
|
bool headless { false };
|
|
bool enable_test_hooks { false };
|
|
};
|
|
|
|
WEB_API Response process_capabilities(JsonValue const& parameters, SessionFlags flags);
|
|
|
|
}
|