Commit 5902e10c authored by Alex Turner's avatar Alex Turner Committed by Chromium LUCI CQ

Improve DCHECK coverage for investigating a crash.

Rarely, a subframe navigation to about:blank can have an ongoing
activation throttle, which is unexpected and triggers a DCHECK.

Such a navigation should not have a throttle created. We add a DCHECK
to ensure a navigation with such a URL does not. We also temporarily add
some DCHECKs that will provide some detail about the redirect chain when
an unexpected filter is found. Finally, we add a DCHECK that covers
uncommitted initial loads. These will only trigger when the original
DCHECK already would have; which DCHECK triggers will tell us details
about the navigation.

Bug: 1155870
Change-Id: Id6ba3f47f75ef871456c2bd311995b4f7ff2ddab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576433
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836773}
parent e2d25bb1
......@@ -348,6 +348,14 @@ ContentSubresourceFilterThrottleManager::FilterForFinishedNavigation(
} else if (ShouldInheritParentActivation(navigation_handle)) {
// Throttles are only constructed for navigations handled by the network
// stack and we only release filters for committed navigations.
// These redundant DCHECKs are temporarily added to investigate a crash.
// TODO(crbug.com/1155870): Remove extra DCHECKs after the crash's cause is
// determined.
DCHECK(!filter || navigation_handle->HasCommitted());
DCHECK(!filter || ShouldInheritActivation(
navigation_handle->GetRedirectChain().front()));
DCHECK(!filter || (navigation_handle->GetRedirectChain().size() == 1));
DCHECK(!filter);
activation_to_inherit =
GetFrameActivationState(navigation_handle->GetParentFrame());
......@@ -462,6 +470,7 @@ void ContentSubresourceFilterThrottleManager::MaybeAppendNavigationThrottles(
content::NavigationHandle* navigation_handle,
std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) {
DCHECK(!navigation_handle->IsSameDocument());
DCHECK(!ShouldInheritActivation(navigation_handle->GetURL()));
if (navigation_handle->IsInMainFrame() &&
client_->GetSafeBrowsingDatabaseManager()) {
......
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