Commit 320fda4d authored by Ryan Sturm's avatar Ryan Sturm Committed by Chromium LUCI CQ

Checking frame tree node is null in client hints

I hit a DCHECK using the frame tree node code path in the devtools code.
I audited the uses of frame tree node, and the two cases that could
possibly DCHECK or AV are these two. It makes sense that there is no way
to access the dev tools code when the fetch is not tied to a frame.

Change-Id: I571b77a4b4934e94ab5f6cf72b7aacdb0a71c67d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2606289Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840235}
parent e4cde57b
......@@ -465,7 +465,7 @@ void UpdateNavigationRequestClientUaHeadersImpl(
bool disable_due_to_custom_ua = false;
if (override_ua) {
NavigatorDelegate* nav_delegate =
frame_tree_node->navigator().GetDelegate();
frame_tree_node ? frame_tree_node->navigator().GetDelegate() : nullptr;
ua_metadata =
nav_delegate ? nav_delegate->GetUserAgentOverride().ua_metadata_override
: base::nullopt;
......@@ -474,7 +474,8 @@ void UpdateNavigationRequestClientUaHeadersImpl(
disable_due_to_custom_ua = !ua_metadata.has_value();
}
if (devtools_instrumentation::ApplyUserAgentMetadataOverrides(frame_tree_node,
if (frame_tree_node &&
devtools_instrumentation::ApplyUserAgentMetadataOverrides(frame_tree_node,
&ua_metadata)) {
// Likewise, if devtools says to override client hints but provides no
// value, disable them. This overwrites previous decision from UI.
......
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