Commit 70852ab7 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Stop showing loading that has not started to devtools

ResourceFetcher::EmulateLoadStartedForInspector can be called with a
Resource whose status is kNotStarted, because some resources (e.g.,
fonts) don't start loading when ResourceFetcher::RequestResource is
called. Showing "emulated" resource loading for such stalled resources
is confusing, so stop doing that.

Bug: 1099256
Change-Id: I0547506fd65fd9ef14c7bb483d92b5eeb42bc21c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2301556
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790715}
parent b0778696
......@@ -2135,8 +2135,14 @@ void ResourceFetcher::EmulateLoadStartedForInspector(
network::mojom::RequestDestination request_destination,
const AtomicString& initiator_name) {
base::AutoReset<bool> r(&is_in_request_resource_, true);
if (CachedResource(url))
if (CachedResource(url)) {
return;
}
if (resource->ErrorOccurred()) {
// We should ideally replay the error steps, but we cannot.
return;
}
ResourceRequest resource_request(url);
resource_request.SetRequestContext(request_context);
resource_request.SetRequestDestination(request_destination);
......@@ -2159,6 +2165,15 @@ void ResourceFetcher::EmulateLoadStartedForInspector(
last_resource_request.Url(), params.Options(),
ReportingDisposition::kReport,
last_resource_request.GetRedirectInfo());
if (resource->GetStatus() == ResourceStatus::kNotStarted ||
resource->GetStatus() == ResourceStatus::kPending) {
// If the loading has not started, then we return here because loading
// related events will be reported to the ResourceLoadObserver. If the
// loading is ongoing, then we return here too because the loading
// activity is merged.
return;
}
DCHECK_EQ(resource->GetStatus(), ResourceStatus::kCached);
DidLoadResourceFromMemoryCache(resource, params.GetResourceRequest(),
false /* is_static_data */);
}
......
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