Commit bea8905d authored by Joey Arhar's avatar Joey Arhar Committed by Commit Bot

Prevent crash when scrolling for find-in-page

The clusterfuzz test case is very large and complicated, so I wasn't
able to reproduce the test case in a normal/minimal page. From debugging
while using the clusterfuzz repro tool, all I can tell is that
find-in-page is trying to scroll to the "Choose File" text node inside
an <input type=file>, and that it doesn't have a LayoutObject for some
reason, despite being attached to the document and the call to
UpdateStyleAndLayoutForNode in the previous block being run.

Bug: 1129341
Change-Id: I6de3eac626899ab15c157150ed5015119c497876
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2419154
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808552}
parent 1966fea7
......@@ -104,6 +104,12 @@ static void ScrollToVisible(Range* match) {
first_node.GetDocument().UpdateStyleAndLayoutForNode(
&first_node, DocumentUpdateReason::kFindInPage);
}
// We don't always have a LayoutObject for the node we're trying to scroll to
// after the async step: crbug.com/1129341
if (!first_node.GetLayoutObject())
return;
Settings* settings = first_node.GetDocument().GetSettings();
bool smooth_find_enabled =
settings ? settings->GetSmoothScrollForFindEnabled() : false;
......
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