aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorDelan Azabani <dazabani@igalia.com>2025-01-25 16:17:50 +0800
committerGitHub <noreply@github.com>2025-01-25 08:17:50 +0000
commit2ce7709b8bd3568405be52f48db060cf9aec5af6 (patch)
treea73b0608cd9f1e126a01c9b7a5f91526c1636e3e /components/script/dom
parentd5d7b0d34f12aec96be76b825851532ac0d33ecf (diff)
downloadservo-2ce7709b8bd3568405be52f48db060cf9aec5af6.tar.gz
servo-2ce7709b8bd3568405be52f48db060cf9aec5af6.zip
libservo: Add an initial WebView data structure to the API (#35119)
This patch introduces a new handle-based webview API to libservo, with two main design goals: 1. The lifetime of the handles controls the lifetime of the webview, giving the embedder full control over exactly when webviews are created and destroyed. This is consistent with how WebKitGTK’s WebView works; the engine can only create webviews via a create request, and can only destroy them via a close request. 2. All methods are infallible; if the constellation dies, the embedder finds out when calling Servo::handle_events. For the moment, the embedder is only responsible for creating the WebView id, and not the internal TopLevelBrowsingContext data structures. This is so that the ScriptThread is able to get a handle on the new WebView's WindowProxy in the case that it's an auxiliary browsing context. In the future, the embedder should also be responsible for creating the TopLevelBrowsingContext and the ScriptThread should have mechanism to associate the two views so that WebView creation is always executed through the same code path in the embedding layer. For now, it's enough that the embedder can get a handle to the new WebView when it's creation is requested. Once we replace EmbedderMsg with a webview delegate trait, we will pass WebView handles to the embedder, rather than webview ids. We’ll also add detailed docs, once the design settles. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/windowproxy.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs
index a4659eedf9d..5f113b5f068 100644
--- a/components/script/dom/windowproxy.rs
+++ b/components/script/dom/windowproxy.rs
@@ -294,8 +294,7 @@ impl WindowProxy {
.unwrap();
let msg = EmbedderMsg::AllowOpeningWebView(chan);
window.send_to_embedder(msg);
- if port.recv().unwrap() {
- let new_top_level_browsing_context_id = TopLevelBrowsingContextId::new();
+ if let Some(new_top_level_browsing_context_id) = port.recv().unwrap() {
let new_browsing_context_id =
BrowsingContextId::from(new_top_level_browsing_context_id);
let new_pipeline_id = PipelineId::new();