Commit 0b780180 authored by Takeshi Yoshino's avatar Takeshi Yoshino Committed by Commit Bot

Make a condition in ResourceFetcher::IsReusableAlsoForPreloading() a little more readable

Bug: 695808
Change-Id: Iab3b5da25eb6c920e3ab998fe7a6cbc69d7222af
Reviewed-on: https://chromium-review.googlesource.com/542995
Commit-Queue: Takeshi Yoshino <tyoshino@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#481890}
parent d9339152
...@@ -1033,17 +1033,32 @@ bool ResourceFetcher::IsReusableAlsoForPreloading(const FetchParameters& params, ...@@ -1033,17 +1033,32 @@ bool ResourceFetcher::IsReusableAlsoForPreloading(const FetchParameters& params,
// //
// TODO(tyoshino): Consider returning false when the credentials mode // TODO(tyoshino): Consider returning false when the credentials mode
// differs. // differs.
if ((params.Options().cors_handling_by_resource_fetcher ==
kEnableCORSHandlingByResourceFetcher &&
params.GetResourceRequest().GetFetchRequestMode() ==
WebURLRequest::kFetchRequestModeCORS) ==
(existing_resource->Options().cors_handling_by_resource_fetcher ==
kEnableCORSHandlingByResourceFetcher &&
existing_resource->GetResourceRequest().GetFetchRequestMode() ==
WebURLRequest::kFetchRequestModeCORS))
return true;
return false; bool new_is_with_fetcher_cors_suppressed =
params.Options().cors_handling_by_resource_fetcher ==
kDisableCORSHandlingByResourceFetcher;
bool existing_was_with_fetcher_cors_suppressed =
existing_resource->Options().cors_handling_by_resource_fetcher ==
kDisableCORSHandlingByResourceFetcher;
bool new_is_with_cors_mode =
params.GetResourceRequest().GetFetchRequestMode() ==
WebURLRequest::kFetchRequestModeCORS;
bool existing_was_with_cors_mode =
existing_resource->GetResourceRequest().GetFetchRequestMode() ==
WebURLRequest::kFetchRequestModeCORS;
if (new_is_with_fetcher_cors_suppressed) {
if (existing_was_with_fetcher_cors_suppressed)
return true;
return !existing_was_with_cors_mode;
}
if (existing_was_with_fetcher_cors_suppressed)
return !new_is_with_cors_mode;
return new_is_with_cors_mode == existing_was_with_cors_mode;
} }
ResourceFetcher::RevalidationPolicy ResourceFetcher::RevalidationPolicy
......
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