mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWebView+WebContent: Add a command-line flag to disable site isolation
This commit is contained in:
parent
89f8dd9b3b
commit
fce5d24e5f
Notes:
github-actions[bot]
2025-03-12 02:02:01 +00:00
Author: https://github.com/trflynn89
Commit: fce5d24e5f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3909
Reviewed-by: https://github.com/tcl3 ✅
6 changed files with 28 additions and 0 deletions
|
@ -79,6 +79,7 @@ void Application::initialize(Main::Arguments const& arguments, URL::URL new_tab_
|
|||
Optional<u16> dns_server_port;
|
||||
bool use_dns_over_tls = false;
|
||||
bool log_all_js_exceptions = false;
|
||||
bool disable_site_isolation = false;
|
||||
bool enable_idl_tracing = false;
|
||||
bool enable_http_cache = false;
|
||||
bool enable_autoplay = false;
|
||||
|
@ -102,6 +103,7 @@ void Application::initialize(Main::Arguments const& arguments, URL::URL new_tab_
|
|||
args_parser.add_option(webdriver_content_ipc_path, "Path to WebDriver IPC for WebContent", "webdriver-content-path", 0, "path", Core::ArgsParser::OptionHideMode::CommandLineAndMarkdown);
|
||||
args_parser.add_option(devtools_port, "Set the Firefox DevTools port (EXPERIMENTAL)", "devtools", 0, "port");
|
||||
args_parser.add_option(log_all_js_exceptions, "Log all JavaScript exceptions", "log-all-js-exceptions");
|
||||
args_parser.add_option(disable_site_isolation, "Disable site isolation", "disable-site-isolation");
|
||||
args_parser.add_option(enable_idl_tracing, "Enable IDL tracing", "enable-idl-tracing");
|
||||
args_parser.add_option(enable_http_cache, "Enable HTTP cache", "enable-http-cache");
|
||||
args_parser.add_option(enable_autoplay, "Enable multimedia autoplay", "enable-autoplay");
|
||||
|
@ -171,6 +173,7 @@ void Application::initialize(Main::Arguments const& arguments, URL::URL new_tab_
|
|||
.executable_path = MUST(String::from_byte_string(MUST(Core::System::current_executable_path()))),
|
||||
.user_agent_preset = move(user_agent_preset),
|
||||
.log_all_js_exceptions = log_all_js_exceptions ? LogAllJSExceptions::Yes : LogAllJSExceptions::No,
|
||||
.disable_site_isolation = disable_site_isolation ? DisableSiteIsolation::Yes : DisableSiteIsolation::No,
|
||||
.enable_idl_tracing = enable_idl_tracing ? EnableIDLTracing::Yes : EnableIDLTracing::No,
|
||||
.enable_http_cache = enable_http_cache ? EnableHTTPCache::Yes : EnableHTTPCache::No,
|
||||
.expose_internals_object = expose_internals_object ? ExposeInternalsObject::Yes : ExposeInternalsObject::No,
|
||||
|
|
|
@ -105,6 +105,8 @@ static ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_proc
|
|||
arguments.append("--layout-test-mode"sv);
|
||||
if (web_content_options.log_all_js_exceptions == WebView::LogAllJSExceptions::Yes)
|
||||
arguments.append("--log-all-js-exceptions"sv);
|
||||
if (web_content_options.disable_site_isolation == WebView::DisableSiteIsolation::Yes)
|
||||
arguments.append("--disable-site-isolation"sv);
|
||||
if (web_content_options.enable_idl_tracing == WebView::EnableIDLTracing::Yes)
|
||||
arguments.append("--enable-idl-tracing"sv);
|
||||
if (web_content_options.enable_http_cache == WebView::EnableHTTPCache::Yes)
|
||||
|
|
|
@ -94,6 +94,11 @@ enum class EnableHTTPCache {
|
|||
Yes,
|
||||
};
|
||||
|
||||
enum class DisableSiteIsolation {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class ExposeInternalsObject {
|
||||
No,
|
||||
Yes,
|
||||
|
@ -131,6 +136,7 @@ struct WebContentOptions {
|
|||
Optional<StringView> user_agent_preset {};
|
||||
IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No };
|
||||
LogAllJSExceptions log_all_js_exceptions { LogAllJSExceptions::No };
|
||||
DisableSiteIsolation disable_site_isolation { DisableSiteIsolation::No };
|
||||
EnableIDLTracing enable_idl_tracing { EnableIDLTracing::No };
|
||||
EnableHTTPCache enable_http_cache { EnableHTTPCache::No };
|
||||
ExposeInternalsObject expose_internals_object { ExposeInternalsObject::No };
|
||||
|
|
|
@ -11,8 +11,18 @@
|
|||
|
||||
namespace WebView {
|
||||
|
||||
static bool s_site_isolation_enabled = true;
|
||||
|
||||
void disable_site_isolation()
|
||||
{
|
||||
s_site_isolation_enabled = false;
|
||||
}
|
||||
|
||||
bool is_url_suitable_for_same_process_navigation(URL::URL const& current_url, URL::URL const& target_url)
|
||||
{
|
||||
if (!s_site_isolation_enabled)
|
||||
return true;
|
||||
|
||||
// Allow navigating from about:blank to any site.
|
||||
if (Web::HTML::url_matches_about_blank(current_url))
|
||||
return true;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
namespace WebView {
|
||||
|
||||
void disable_site_isolation();
|
||||
[[nodiscard]] bool is_url_suitable_for_same_process_navigation(URL::URL const& current_url, URL::URL const& target_url);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue