2023-08-01 17:39:19 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2024-07-30 15:01:05 -03:00
|
|
|
#include <AK/ByteString.h>
|
|
|
|
|
#include <AK/Optional.h>
|
2024-01-16 14:55:40 -03:00
|
|
|
#include <AK/String.h>
|
2024-07-30 15:01:05 -03:00
|
|
|
#include <AK/Vector.h>
|
|
|
|
|
#include <LibURL/URL.h>
|
2024-08-01 08:03:03 -03:00
|
|
|
#include <LibWebView/ProcessType.h>
|
2024-01-16 14:55:40 -03:00
|
|
|
|
2024-07-30 15:01:05 -03:00
|
|
|
namespace WebView {
|
|
|
|
|
|
2025-06-06 16:42:12 -03:00
|
|
|
enum class HeadlessMode {
|
|
|
|
|
Screenshot,
|
|
|
|
|
LayoutTree,
|
|
|
|
|
Text,
|
|
|
|
|
Test,
|
|
|
|
|
};
|
|
|
|
|
|
2024-07-30 15:01:05 -03:00
|
|
|
enum class NewWindow {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class ForceNewProcess {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class AllowPopups {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-09-04 03:13:40 -03:00
|
|
|
enum class DisableScripting {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-07-30 15:01:05 -03:00
|
|
|
enum class DisableSQLDatabase {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-09-22 19:12:36 -03:00
|
|
|
enum class EnableAutoplay {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-11-01 19:53:43 -03:00
|
|
|
struct SystemDNS { };
|
|
|
|
|
struct DNSOverTLS {
|
|
|
|
|
ByteString server_address;
|
|
|
|
|
u16 port;
|
2025-05-13 07:34:55 -03:00
|
|
|
bool validate_dnssec_locally;
|
2024-11-01 19:53:43 -03:00
|
|
|
};
|
|
|
|
|
struct DNSOverUDP {
|
|
|
|
|
ByteString server_address;
|
|
|
|
|
u16 port;
|
2025-05-13 07:34:55 -03:00
|
|
|
bool validate_dnssec_locally;
|
2024-11-01 19:53:43 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using DNSSettings = Variant<SystemDNS, DNSOverTLS, DNSOverUDP>;
|
|
|
|
|
|
2025-03-15 11:09:45 -03:00
|
|
|
constexpr inline u16 default_devtools_port = 6000;
|
|
|
|
|
|
2025-03-15 17:56:52 -03:00
|
|
|
struct BrowserOptions {
|
2024-07-30 15:01:05 -03:00
|
|
|
Vector<URL::URL> urls;
|
|
|
|
|
Vector<ByteString> raw_urls;
|
2025-06-06 16:42:12 -03:00
|
|
|
Optional<HeadlessMode> headless_mode;
|
|
|
|
|
int window_width { 800 };
|
|
|
|
|
int window_height { 600 };
|
2024-07-30 15:01:05 -03:00
|
|
|
Vector<ByteString> certificates {};
|
|
|
|
|
NewWindow new_window { NewWindow::No };
|
|
|
|
|
ForceNewProcess force_new_process { ForceNewProcess::No };
|
|
|
|
|
AllowPopups allow_popups { AllowPopups::No };
|
2024-09-04 03:13:40 -03:00
|
|
|
DisableScripting disable_scripting { DisableScripting::No };
|
2024-07-30 15:01:05 -03:00
|
|
|
DisableSQLDatabase disable_sql_database { DisableSQLDatabase::No };
|
2024-08-01 08:03:03 -03:00
|
|
|
Optional<ProcessType> debug_helper_process {};
|
2024-08-01 08:13:09 -03:00
|
|
|
Optional<ProcessType> profile_helper_process {};
|
2024-07-30 15:01:05 -03:00
|
|
|
Optional<ByteString> webdriver_content_ipc_path {};
|
2025-04-07 22:56:35 -03:00
|
|
|
Optional<DNSSettings> dns_settings {};
|
2025-07-02 13:42:53 -03:00
|
|
|
Optional<u16> devtools_port;
|
2024-07-30 15:01:05 -03:00
|
|
|
};
|
2023-08-02 14:52:59 -03:00
|
|
|
|
2023-12-01 14:18:40 -03:00
|
|
|
enum class IsLayoutTestMode {
|
|
|
|
|
No,
|
2024-07-30 15:01:05 -03:00
|
|
|
Yes,
|
2023-12-01 14:18:40 -03:00
|
|
|
};
|
|
|
|
|
|
2024-04-16 03:02:41 -03:00
|
|
|
enum class LogAllJSExceptions {
|
|
|
|
|
No,
|
2024-07-30 15:01:05 -03:00
|
|
|
Yes,
|
2024-04-16 03:02:41 -03:00
|
|
|
};
|
|
|
|
|
|
2024-04-16 09:39:57 -03:00
|
|
|
enum class EnableIDLTracing {
|
|
|
|
|
No,
|
2024-07-30 15:01:05 -03:00
|
|
|
Yes,
|
2024-04-16 09:39:57 -03:00
|
|
|
};
|
|
|
|
|
|
2024-06-22 13:53:11 -03:00
|
|
|
enum class EnableHTTPCache {
|
|
|
|
|
No,
|
2024-07-30 15:01:05 -03:00
|
|
|
Yes,
|
2024-06-22 13:53:11 -03:00
|
|
|
};
|
|
|
|
|
|
2025-03-11 20:25:34 -03:00
|
|
|
enum class DisableSiteIsolation {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-04-20 17:46:38 -03:00
|
|
|
enum class ExposeInternalsObject {
|
|
|
|
|
No,
|
2024-07-30 15:01:05 -03:00
|
|
|
Yes,
|
2024-04-20 17:46:38 -03:00
|
|
|
};
|
|
|
|
|
|
2024-08-01 14:49:24 -03:00
|
|
|
enum class ForceCPUPainting {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-19 15:35:49 -03:00
|
|
|
enum class ForceFontconfig {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-31 12:06:01 -03:00
|
|
|
enum class CollectGarbageOnEveryAllocation {
|
|
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2024-12-16 08:23:10 -03:00
|
|
|
enum class PaintViewportScrollbars {
|
|
|
|
|
Yes,
|
|
|
|
|
No,
|
|
|
|
|
};
|
|
|
|
|
|
2023-12-01 14:18:40 -03:00
|
|
|
struct WebContentOptions {
|
2024-01-16 14:55:40 -03:00
|
|
|
String command_line;
|
|
|
|
|
String executable_path;
|
2024-07-16 13:52:12 -03:00
|
|
|
Optional<ByteString> config_path {};
|
2024-08-28 11:26:11 -03:00
|
|
|
Optional<StringView> user_agent_preset {};
|
2023-12-01 14:18:40 -03:00
|
|
|
IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No };
|
2024-04-16 03:02:41 -03:00
|
|
|
LogAllJSExceptions log_all_js_exceptions { LogAllJSExceptions::No };
|
2025-03-11 20:25:34 -03:00
|
|
|
DisableSiteIsolation disable_site_isolation { DisableSiteIsolation::No };
|
2024-04-16 09:39:57 -03:00
|
|
|
EnableIDLTracing enable_idl_tracing { EnableIDLTracing::No };
|
2024-06-22 13:53:11 -03:00
|
|
|
EnableHTTPCache enable_http_cache { EnableHTTPCache::No };
|
2024-04-20 17:46:38 -03:00
|
|
|
ExposeInternalsObject expose_internals_object { ExposeInternalsObject::No };
|
2024-08-01 14:49:24 -03:00
|
|
|
ForceCPUPainting force_cpu_painting { ForceCPUPainting::No };
|
2024-08-19 15:35:49 -03:00
|
|
|
ForceFontconfig force_fontconfig { ForceFontconfig::No };
|
2024-09-22 19:12:36 -03:00
|
|
|
EnableAutoplay enable_autoplay { EnableAutoplay::No };
|
2024-10-31 12:06:01 -03:00
|
|
|
CollectGarbageOnEveryAllocation collect_garbage_on_every_allocation { CollectGarbageOnEveryAllocation::No };
|
2024-12-02 22:33:26 -03:00
|
|
|
Optional<u16> echo_server_port {};
|
2024-12-16 08:23:10 -03:00
|
|
|
PaintViewportScrollbars paint_viewport_scrollbars { PaintViewportScrollbars::Yes };
|
2023-12-01 14:18:40 -03:00
|
|
|
};
|
|
|
|
|
|
2023-08-02 14:52:59 -03:00
|
|
|
}
|