Skip to content

Truly independent web browser

WebContent: Skip cross-site frames when inspecting grid layouts

sideshowbarker5cd7ca6ec4ff
diff --git a/Services/WebContent/ConnectionFromClient.cpp b/Services/WebContent/ConnectionFromClient.cpp
index 455a1d06ef8..cd51da62bbe 100644
--- a/Services/WebContent/ConnectionFromClient.cpp
+++ b/Services/WebContent/ConnectionFromClient.cpp
@@ -1543,7 +1543,12 @@ static void append_grid_layouts_for_node_and_frame_descendants(Web::DOM::Node& r
if (!content_navigable)
return Web::TraversalDecision::Continue;
- auto content_document = as<Web::HTML::LocalNavigable>(*content_navigable).active_document();
+ // A cross-site frame's document lives in another process, so its grids can't be inspected from here.
+ auto* local_content_navigable = as_if<Web::HTML::LocalNavigable>(*content_navigable);
+ if (!local_content_navigable)
+ return Web::TraversalDecision::Continue;
+
+ auto content_document = local_content_navigable->active_document();
if (!content_document)
return Web::TraversalDecision::Continue;