mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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:
committed by
Jelle Raaijmakers
parent
a34f7a5bd1
commit
5810c8073e
Notes:
github-actions[bot]
2025-03-11 11:11:49 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/5810c8073e7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3882 Reviewed-by: https://github.com/gmta ✅
@@ -1349,6 +1349,12 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
|
||||
auto& active_document = *this->active_document();
|
||||
auto& realm = active_document.realm();
|
||||
|
||||
// AD-HOC: If we are not able to continue in this process, request a new process from the UI.
|
||||
if (!active_document.page().client().is_url_suitable_for_same_process_navigation(active_document.url(), params.url)) {
|
||||
active_document.page().client().request_new_process_for_navigation(params.url);
|
||||
return {};
|
||||
}
|
||||
|
||||
// 2. Let sourceSnapshotParams be the result of snapshotting source snapshot params given sourceDocument.
|
||||
auto source_snapshot_params = source_document->snapshot_source_snapshot_params();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user