Commit ba1e43f1 authored by Hayato Ito's avatar Hayato Ito Committed by Commit Bot

[IncrementalShadowDOM] Avoid crash when Inspector gets distributed nodes for a slot

HTMLSlotElement starts to detect unsupported member functions being called
after https://chromium-review.googlesource.com/c/chromium/src/+/989525.

This CL avoids a crash by early return.

Note that *distributed nodes* are a kind of old-fashioned concept after Blink
supports slots-in-flat-tree. We might want to remove that in the future.

Bug: 776656
Change-Id: Ibe8c4cf935a7f03fe4e716b6877b9bdb8b964983
Reviewed-on: https://chromium-review.googlesource.com/992075
Commit-Queue: Hayato Ito <hayato@chromium.org>
Reviewed-by: default avatarTakayoshi Kochi <kochi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547981}
parent 11e669ec
...@@ -1658,6 +1658,12 @@ std::unique_ptr<protocol::Array<protocol::DOM::BackendNode>> ...@@ -1658,6 +1658,12 @@ std::unique_ptr<protocol::Array<protocol::DOM::BackendNode>>
InspectorDOMAgent::BuildDistributedNodesForSlot(HTMLSlotElement* slot_element) { InspectorDOMAgent::BuildDistributedNodesForSlot(HTMLSlotElement* slot_element) {
std::unique_ptr<protocol::Array<protocol::DOM::BackendNode>> std::unique_ptr<protocol::Array<protocol::DOM::BackendNode>>
distributed_nodes = protocol::Array<protocol::DOM::BackendNode>::create(); distributed_nodes = protocol::Array<protocol::DOM::BackendNode>::create();
if (RuntimeEnabledFeatures::IncrementalShadowDOMEnabled()) {
// TODO(hayato): Support distributed_nodes for IncrementalShadowDOM.
// We might use HTMLSlotElement::flat_tree_children here, however, we don't
// want to expose it, as of now.
return distributed_nodes;
}
for (Node* node = slot_element->FirstDistributedNode(); node; for (Node* node = slot_element->FirstDistributedNode(); node;
node = slot_element->DistributedNodeNextTo(*node)) { node = slot_element->DistributedNodeNextTo(*node)) {
if (IsWhitespace(node)) if (IsWhitespace(node))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment