Commit 80364391 authored by Yoav Weiss's avatar Yoav Weiss Committed by Commit Bot

Usecounter for AppCache installed pages with no manifest

The very fact that AppCache is supported introduces a delay to preloaded
requests. We could use the `manifest` attribute to detect pages where
AppCache is used and only delay requests there.
This CL adds a counter for pages where this heuristic will fail (and
likely result in a spurious download). Assuming the counter is
relatively low, we'd be able to go ahead with implementing the
heuristic.

Bug: 788757
Change-Id: If5ca0c8682fa677677df38f59946b3198588d4a3
Reviewed-on: https://chromium-review.googlesource.com/c/1442051
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626968}
parent 3756dc81
......@@ -2204,6 +2204,7 @@ enum WebFeature {
kHTMLTemplateElement = 2769,
kNoSysexWebMIDIWithoutPermission = 2770,
kNoSysexWebMIDIOnInsecureOrigin = 2771,
kApplicationCacheInstalledButNoManifest = 2772,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -84,11 +84,20 @@ void HTMLHtmlElement::MaybeSetupApplicationCache() {
return;
}
ApplicationCacheHost* host = document_loader->GetApplicationCacheHost();
DCHECK(host);
if (manifest.IsEmpty())
document_loader->GetApplicationCacheHost()->SelectCacheWithoutManifest();
host->SelectCacheWithoutManifest();
else
document_loader->GetApplicationCacheHost()->SelectCacheWithManifest(
GetDocument().CompleteURL(manifest));
host->SelectCacheWithManifest(GetDocument().CompleteURL(manifest));
bool app_cache_installed =
host->GetStatus() !=
blink::mojom::AppCacheStatus::APPCACHE_STATUS_UNCACHED;
if (app_cache_installed && manifest.IsEmpty()) {
UseCounter::Count(GetDocument(),
WebFeature::kApplicationCacheInstalledButNoManifest);
}
}
} // namespace blink
......@@ -21468,6 +21468,7 @@ Called by update_net_error_codes.py.-->
<int value="2769" label="HTMLTemplateElement"/>
<int value="2770" label="NoSysexWebMIDIWithoutPermission"/>
<int value="2771" label="NoSysexWebMIDIOnInsecureOrigin"/>
<int value="2772" label="ApplicationCacheInstalledButNoManifest"/>
</enum>
<enum name="FeaturePolicyFeature">
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