Commit 4e63e1a3 authored by Emily Stark's avatar Emily Stark Committed by Commit Bot

Add UseCounters for subresources with CT errors

When a subresource fails to load with
net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED, increment a UseCounter for the
document. This gives an upper-bound estimate on the percent of page loads with
user-visible CT-induced breakage. (A subresource failing to load might or might
not be user-visible breakage, which is why it's an upper bound.)

This metric will be useful for evaluating user impact as we roll out more
Certificate Transparency enforcement.

Note that this does not yet count subframe errors, due to some larger
PlzNavigate-related problems with how iframe errors are sent to
renderers. (https://crbug.com/750901)

Bug: 772534
Change-Id: Ib2367aea4556e355c9c4b3406199c177b0a6be79
Reviewed-on: https://chromium-review.googlesource.com/798639
Commit-Queue: Emily Stark <estark@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520868}
parent 29c96a0e
......@@ -79,6 +79,7 @@
#include "platform/loader/fetch/fetch_initiator_type_names.h"
#include "platform/mhtml/MHTMLArchive.h"
#include "platform/network/NetworkStateNotifier.h"
#include "platform/network/NetworkUtils.h"
#include "platform/network/http_names.h"
#include "platform/scheduler/child/web_scheduler.h"
#include "platform/scheduler/renderer/web_view_scheduler.h"
......@@ -609,6 +610,12 @@ void FrameFetchContext::DispatchDidFail(unsigned long identifier,
if (IsDetached())
return;
if (NetworkUtils::IsCertificateTransparencyRequiredError(error.ErrorCode())) {
UseCounter::Count(
GetFrame()->GetDocument(),
WebFeature::kCertificateTransparencyRequiredErrorOnResourceLoad);
}
GetFrame()->Loader().Progress().CompleteProgress(identifier);
probe::didFailLoading(GetFrame()->GetDocument(), identifier,
MasterDocumentLoader(), error);
......
......@@ -17,6 +17,7 @@
#include "platform/exported/WrappedResourceRequest.h"
#include "platform/loader/fetch/ResourceFetcher.h"
#include "platform/network/NetworkStateNotifier.h"
#include "platform/network/NetworkUtils.h"
#include "platform/runtime_enabled_features.h"
#include "platform/weborigin/SecurityPolicy.h"
#include "public/platform/Platform.h"
......@@ -318,6 +319,9 @@ void WorkerFetchContext::DispatchDidFail(unsigned long identifier,
int64_t encoded_data_length,
bool is_internal_request) {
probe::didFailLoading(global_scope_, identifier, nullptr, error);
if (NetworkUtils::IsCertificateTransparencyRequiredError(error.ErrorCode())) {
CountUsage(WebFeature::kCertificateTransparencyRequiredErrorOnResourceLoad);
}
}
void WorkerFetchContext::AddResourceTiming(const ResourceTimingInfo& info) {
......
......@@ -119,6 +119,10 @@ bool IsRedirectResponseCode(int response_code) {
return net::HttpResponseHeaders::IsRedirectResponseCode(response_code);
}
bool IsCertificateTransparencyRequiredError(int error_code) {
return error_code == net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED;
}
} // NetworkUtils
} // namespace blink
......@@ -40,6 +40,8 @@ PLATFORM_EXPORT bool IsDataURLMimeTypeSupported(const KURL&);
PLATFORM_EXPORT bool IsRedirectResponseCode(int);
PLATFORM_EXPORT bool IsCertificateTransparencyRequiredError(int);
} // NetworkUtils
} // namespace blink
......
......@@ -1777,6 +1777,7 @@ enum WebFeature {
kLocalCSSFile = 2256,
kLocalCSSFileExtensionRejected = 2257,
kUserMediaDisableHardwareNoiseSuppression = 2258,
kCertificateTransparencyRequiredErrorOnResourceLoad = 2259,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -17109,6 +17109,7 @@ Called by update_net_error_codes.py.-->
<int value="2256" label="LocalCSSFile"/>
<int value="2257" label="LocalCSSFileExtensionRejected"/>
<int value="2258" label="UserMediaDisableHardwareNoiseSuppression"/>
<int value="2259" label="CertificateTransparencyRequiredErrorOnResourceLoad"/>
</enum>
<enum name="FeedbackSource">
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