diff --git a/Libraries/LibWebView/SiteIsolation.cpp b/Libraries/LibWebView/SiteIsolation.cpp index b24ddf4027b..c937a70e4cd 100644 --- a/Libraries/LibWebView/SiteIsolation.cpp +++ b/Libraries/LibWebView/SiteIsolation.cpp @@ -27,6 +27,10 @@ bool is_url_suitable_for_same_process_navigation(URL::URL const& current_url, UR if (Web::HTML::url_matches_about_blank(current_url)) return true; + // Make sure JavaScript URLs run in the same process. + if (target_url.scheme() == "javascript"sv) + return true; + // Allow cross-scheme non-HTTP(S) navigation. Disallow cross-scheme HTTP(s) navigation. auto current_url_is_http = Web::Fetch::Infrastructure::is_http_or_https_scheme(current_url.scheme()); auto target_url_is_http = Web::Fetch::Infrastructure::is_http_or_https_scheme(target_url.scheme()); diff --git a/Tests/LibWeb/Text/expected/HTML/javascript-navigation-stays-in-same-process.txt b/Tests/LibWeb/Text/expected/HTML/javascript-navigation-stays-in-same-process.txt new file mode 100644 index 00000000000..56ba9218d98 --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/javascript-navigation-stays-in-same-process.txt @@ -0,0 +1 @@ +Hello world, this was printed by a JavaScript navigation! diff --git a/Tests/LibWeb/Text/input/HTML/javascript-navigation-stays-in-same-process.html b/Tests/LibWeb/Text/input/HTML/javascript-navigation-stays-in-same-process.html new file mode 100644 index 00000000000..8f63ea250a7 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/javascript-navigation-stays-in-same-process.html @@ -0,0 +1,11 @@ + + +
Hello world, this was printed by a JavaScript navigation!
+