Commit 6d890c8b authored by rajendrant's avatar rajendrant Committed by Commit Bot

Do not restart requests based on finch flag

When enable_lite_page_redirect is unset, the subresource redirect
throttle should not restart the requests.

TBR=mcrouse@chromium.org

Bug: 1059606
Change-Id: Id80ae397d831d4b99e41b5bc10a22ee548f49fa0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094319Reviewed-by: default avatarrajendrant <rajendrant@chromium.org>
Commit-Queue: rajendrant <rajendrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748057}
parent aa7438aa
......@@ -153,12 +153,17 @@ void SubresourceRedirectURLLoaderThrottle::BeforeWillProcessResponse(
response_head.headers->response_code() == 304) {
return;
}
redirect_result_ =
SubresourceRedirectHintsAgent::RedirectResult::kIneligibleOtherImage;
if (!base::GetFieldTrialParamByFeatureAsBool(
blink::features::kSubresourceRedirect, "enable_lite_page_redirect",
false)) {
return;
}
// Non 2XX responses from the compression server need to have unaltered
// requests sent to the original resource.
delegate_->RestartWithURLResetAndFlags(net::LOAD_NORMAL);
redirect_result_ =
SubresourceRedirectHintsAgent::RedirectResult::kIneligibleOtherImage;
}
void SubresourceRedirectURLLoaderThrottle::WillProcessResponse(
......@@ -210,13 +215,19 @@ void SubresourceRedirectURLLoaderThrottle::WillProcessResponse(
void SubresourceRedirectURLLoaderThrottle::WillOnCompleteWithError(
const network::URLLoaderCompletionStatus& status,
bool* defer) {
redirect_result_ =
SubresourceRedirectHintsAgent::RedirectResult::kIneligibleOtherImage;
if (!base::GetFieldTrialParamByFeatureAsBool(
blink::features::kSubresourceRedirect, "enable_lite_page_redirect",
false)) {
return;
}
// If the server fails, restart the request to the original resource, and
// record it.
delegate_->RestartWithURLResetAndFlags(net::LOAD_NORMAL);
UMA_HISTOGRAM_BOOLEAN(
"SubresourceRedirect.CompressionAttempt.ServerResponded", false);
redirect_result_ =
SubresourceRedirectHintsAgent::RedirectResult::kIneligibleOtherImage;
}
void SubresourceRedirectURLLoaderThrottle::DetachFromCurrentSequence() {}
......
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