WebContent: Ignore stale DevTools highlight requests
Firefox can still send highlight requests for node fronts that are being replaced during navigation. Those node IDs can refer to a disconnected or inactive document. Active documents may also have dirty layout by the time the request arrives. Ignore stale nodes and update layout before reading the layout node. This keeps late highlight requests from tripping layout freshness assertions.
This commit is contained in:
parent
5283f669a1
commit
bbb4be8c1e
1 changed files with 11 additions and 2 deletions
|
|
@ -1002,10 +1002,19 @@ void ConnectionFromClient::highlight_dom_node(u64 page_id, Web::UniqueNodeID nod
|
|||
}
|
||||
|
||||
auto* node = Web::DOM::Node::from_unique_id(node_id);
|
||||
if (!node || !node->layout_node())
|
||||
if (!node || !node->is_connected())
|
||||
return;
|
||||
|
||||
node->document().set_highlighted_node(node, pseudo_element);
|
||||
auto& document = node->document();
|
||||
auto navigable = document.navigable();
|
||||
if (!navigable || navigable->active_document() != &document)
|
||||
return;
|
||||
|
||||
document.update_layout(Web::DOM::UpdateLayoutReason::Debugging);
|
||||
if (!node->layout_node())
|
||||
return;
|
||||
|
||||
document.set_highlighted_node(node, pseudo_element);
|
||||
}
|
||||
|
||||
static Web::Painting::FlexboxInspectorOverlayOptions flexbox_inspector_overlay_options_from_json(JsonValue const& options)
|
||||
|
|
|
|||
Loading…
Reference in a new issue