Commit bdf04d9f authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Make DCHECKs in URLLoader::CompleteBlockedResponse redirect-friendly.

This CL fixes a NetworkService DCHECK failure/crash that is behind the
layout test flakiness under wpt/fetch/cross-origin-resource-policy as
pointed out in https://crbug.com/1067445#c17.

Bug: 1067445
Change-Id: I3c516a09f68a722f6dad555f6467379e7d8fe2d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136028Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756408}
parent c0805cf8
...@@ -1824,9 +1824,12 @@ void URLLoader::CompleteBlockedResponse( ...@@ -1824,9 +1824,12 @@ void URLLoader::CompleteBlockedResponse(
int error_code, int error_code,
bool should_report_corb_blocking, bool should_report_corb_blocking,
base::Optional<BlockedByResponseReason> reason) { base::Optional<BlockedByResponseReason> reason) {
// The response headers and body shouldn't yet be sent to the URLLoaderClient. if (has_received_response_) {
DCHECK(response_); // The response headers and body shouldn't yet be sent to the
DCHECK(consumer_handle_.is_valid()); // URLLoaderClient.
DCHECK(response_);
DCHECK(consumer_handle_.is_valid());
}
// Tell the URLLoaderClient that the response has been completed. // Tell the URLLoaderClient that the response has been completed.
URLLoaderCompletionStatus status; URLLoaderCompletionStatus status;
...@@ -1845,6 +1848,9 @@ void URLLoader::CompleteBlockedResponse( ...@@ -1845,6 +1848,9 @@ void URLLoader::CompleteBlockedResponse(
} }
URLLoader::BlockResponseForCorbResult URLLoader::BlockResponseForCorb() { URLLoader::BlockResponseForCorbResult URLLoader::BlockResponseForCorb() {
// CORB should only do work after the response headers have been received.
DCHECK(has_received_response_);
// The response headers and body shouldn't yet be sent to the URLLoaderClient. // The response headers and body shouldn't yet be sent to the URLLoaderClient.
DCHECK(response_); DCHECK(response_);
DCHECK(consumer_handle_.is_valid()); DCHECK(consumer_handle_.is_valid());
......
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