LibWeb+LibWebView+WebContent: Begin implementing simple site islotation

Site isolation is a common technique to reduce the chance that malicious
sites can access data from other sites. When the user navigates, we now
check if the target site is the same as the current site. If not, we
instruct the UI to perform the navigation in a new WebContent process.

The phrase "site" here is defined as the public suffix of the URL plus
one level. This means that navigating from "www.example.com" to
"sub.example.com" remains in the same process.

There's plenty of room for optimization around this. For example, we can
create a spare WebContent process ahead of time to hot-swap the target
site. We can also create a policy to keep the navigated-from process
around, in case the user quickly navigates back.
This commit is contained in:
Timothy Flynn 2025-03-09 11:40:34 -04:00 committed by Jelle Raaijmakers
commit 5810c8073e
Notes: github-actions[bot] 2025-03-11 11:11:49 +00:00
12 changed files with 94 additions and 0 deletions

View file

@ -111,6 +111,8 @@ private:
// ^PageClient
virtual bool is_connection_open() const override;
virtual bool is_url_suitable_for_same_process_navigation(URL::URL const& current_url, URL::URL const& target_url) const override;
virtual void request_new_process_for_navigation(URL::URL const&) override;
virtual Gfx::Palette palette() const override;
virtual Web::DevicePixelRect screen_rect() const override { return m_screen_rect; }
virtual Web::CSS::PreferredColorScheme preferred_color_scheme() const override { return m_preferred_color_scheme; }