Skip to content

Commit 6ee4b86

Browse files
hanselfmu-chromiumCommit Bot
authored andcommitted
Fix node missing ownerDocument issue in getComputedStyleForNode
In rare cases, DevTools frontend will call getComputedStyleForNode on a node that no longer has an owner document. This CL fixes this case, other it will result in a DCHECK failure in document.cc. Change-Id: I33b023e9ee600294cb8a3e9ea833b48e60bc0827 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421668 Reviewed-by: Simon Zünd <[email protected]> Reviewed-by: Alex Rudenko <[email protected]> Reviewed-by: Sigurd Schneider <[email protected]> Reviewed-by: Peter Marshall <[email protected]> Commit-Queue: Sigurd Schneider <[email protected]> Commit-Queue: Changhao Han <[email protected]> Auto-Submit: Changhao Han <[email protected]> Cr-Commit-Position: refs/heads/master@{#808852}
1 parent 39ffbeb commit 6ee4b86

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

third_party/blink/renderer/core/inspector/inspector_css_agent.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,8 @@ Response InspectorCSSAgent::getComputedStyleForNode(
11921192
response = dom_agent_->AssertNode(node_id, node);
11931193
if (!response.IsSuccess())
11941194
return response;
1195+
if (!node->ownerDocument())
1196+
return Response::ServerError("Node does not have an owner document");
11951197

11961198
auto* computed_style_info =
11971199
MakeGarbageCollected<CSSComputedStyleDeclaration>(node, true);

0 commit comments

Comments
 (0)