Commit f1d85da8 authored by Lily Chen's avatar Lily Chen Committed by Chromium LUCI CQ

Add metrics for cookie expiration dates with abbreviated 2-digit year

To assess compatibility impact of fixing behavior for year 69 (i.e.
change it from current behavior, 1969, to 2069, as described by the
spec).

Bug: 907610
Change-Id: Ia4639d34ca02144915aed47db4859aa545fae9c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2605353Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Lily Chen <chlily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839803}
parent 334cad47
......@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/check.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/stl_util.h"
......@@ -313,6 +314,16 @@ base::Time ParseCookieExpirationTime(const std::string& time_string) {
return base::Time();
}
// Log metrics for use of abbreviated, 2-digit, year numbers to determine
// compat impact of fixing behavior for year 69.
// (crbug.com/907610) We currently treat 69 as 1969, whereas the spec says to
// treat it as 2069:
// https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-07#page-17
if (exploded.year >= 0 && exploded.year <= 99) {
base::UmaHistogramExactLinear("Cookie.AbbreviatedExpirationYear",
exploded.year, 100);
}
// Normalize the year to expand abbreviated years to the full year.
if (exploded.year >= 69 && exploded.year <= 99)
exploded.year += 1900;
......
......@@ -21,6 +21,17 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histograms>
<histogram name="Cookie.AbbreviatedExpirationYear" units="year"
expires_after="2021-06-30">
<owner>chlily@chromium.org</owner>
<owner>morlovich@chromium.org</owner>
<summary>
Records the abbreviated 2-digit year number used in a cookie's expiration
date. Emitted when parsing a cookie with an Expires attribute that specifies
an expiration year as a number between 0 and 99 inclusive.
</summary>
</histogram>
<histogram name="Cookie.BackingStoreUpdateResults" enum="BackingStoreResults"
expires_after="M82">
<owner>morlovich@chromium.org</owner>
......
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