mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
LibWebView: Keep javascript URL navigations in the same process
JavaScript URLs run in the same document context the navigation was started in, so they're not eligible to be moved to a new WebContent process. Fixes the "Login as demo user" link on https://demo.immich.app/
This commit is contained in:
parent
c8787e6a9f
commit
61c1e4a855
Notes:
github-actions[bot]
2025-03-16 15:00:33 +00:00
Author: https://github.com/Lubrsi
Commit: 61c1e4a855
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3966
3 changed files with 16 additions and 0 deletions
|
@ -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());
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Hello world, this was printed by a JavaScript navigation!
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<div id="test">Hello world, this was printed by a JavaScript navigation!</div>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
location.href = "javascript:void println(document.getElementById('test').innerText)";
|
||||
setTimeout(() => {
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue