Commit 6edfcc42 authored by Douglas Creager's avatar Douglas Creager Committed by Commit Bot

Network Error Logging: Remove redundant `uri` field

Per https://github.com/w3c/network-error-logging/pull/90, a NEL report's
`url` field now contains the (sanitized) URL of the request that the
report describes.  (Before that spec update, it was supposed to contain
the URL of the page that made the request, which isn't relevant for
NEL.)  Now that the report contains the "right" URL, the NEL body's
`uri` field is redundant, and can be removed.

Bug: 748549
Change-Id: Ibd2b0213b829e94329ecc7263baecd549d41e40c
Reviewed-on: https://chromium-review.googlesource.com/1141271Reviewed-by: default avatarMisha Efimov <mef@chromium.org>
Commit-Queue: Douglas Creager <dcreager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576312}
parent 8381fbe9
...@@ -152,13 +152,12 @@ IN_PROC_BROWSER_TEST_F(ReportingBrowserTest, TestReportingHeadersProcessed) { ...@@ -152,13 +152,12 @@ IN_PROC_BROWSER_TEST_F(ReportingBrowserTest, TestReportingHeadersProcessed) {
"status_code": 204, "status_code": 204,
"phase": "application", "phase": "application",
"type": "ok", "type": "ok",
"uri": "https://example.com:%d/original",
}, },
"type": "network-error", "type": "network-error",
"url": "https://example.com:%d/original", "url": "https://example.com:%d/original",
}, },
] ]
)json", )json",
port(), port())); port()));
EXPECT_EQ(*expected, *actual); EXPECT_EQ(*expected, *actual);
} }
...@@ -206,7 +206,6 @@ TEST_F(NetworkErrorLoggingEndToEndTest, MAYBE_ReportNetworkError) { ...@@ -206,7 +206,6 @@ TEST_F(NetworkErrorLoggingEndToEndTest, MAYBE_ReportNetworkError) {
ExpectDictStringValue("http.response.empty", *body_dict, "type"); ExpectDictStringValue("http.response.empty", *body_dict, "type");
ExpectDictIntegerValue(0, *body_dict, "status_code"); ExpectDictIntegerValue(0, *body_dict, "status_code");
ExpectDictStringValue(GetFailURL().spec(), *body_dict, "uri");
} }
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -546,7 +546,6 @@ class NetworkErrorLoggingServiceImpl : public NetworkErrorLoggingService { ...@@ -546,7 +546,6 @@ class NetworkErrorLoggingServiceImpl : public NetworkErrorLoggingService {
const RequestDetails& details) const { const RequestDetails& details) const {
auto body = std::make_unique<base::DictionaryValue>(); auto body = std::make_unique<base::DictionaryValue>();
body->SetString(kUriKey, details.uri.spec());
body->SetString(kReferrerKey, details.referrer.spec()); body->SetString(kReferrerKey, details.referrer.spec());
body->SetDouble(kSamplingFractionKey, sampling_fraction); body->SetDouble(kSamplingFractionKey, sampling_fraction);
body->SetString(kServerIpKey, details.server_ip.ToString()); body->SetString(kServerIpKey, details.server_ip.ToString());
...@@ -586,7 +585,6 @@ const char NetworkErrorLoggingService::kReportType[] = "network-error"; ...@@ -586,7 +585,6 @@ const char NetworkErrorLoggingService::kReportType[] = "network-error";
// that generate new NEL reports to bypass the age limit on Reporting reports. // that generate new NEL reports to bypass the age limit on Reporting reports.
const int NetworkErrorLoggingService::kMaxNestedReportDepth = 1; const int NetworkErrorLoggingService::kMaxNestedReportDepth = 1;
const char NetworkErrorLoggingService::kUriKey[] = "uri";
const char NetworkErrorLoggingService::kReferrerKey[] = "referrer"; const char NetworkErrorLoggingService::kReferrerKey[] = "referrer";
const char NetworkErrorLoggingService::kSamplingFractionKey[] = const char NetworkErrorLoggingService::kSamplingFractionKey[] =
"sampling_fraction"; "sampling_fraction";
......
...@@ -78,7 +78,6 @@ class NET_EXPORT NetworkErrorLoggingService { ...@@ -78,7 +78,6 @@ class NET_EXPORT NetworkErrorLoggingService {
// Keys for data included in report bodies. Exposed for tests. // Keys for data included in report bodies. Exposed for tests.
static const char kUriKey[];
static const char kReferrerKey[]; static const char kReferrerKey[];
static const char kSamplingFractionKey[]; static const char kSamplingFractionKey[];
static const char kServerIpKey[]; static const char kServerIpKey[];
......
...@@ -260,8 +260,6 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessReportQueued) { ...@@ -260,8 +260,6 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessReportQueued) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
// TODO(juliatuttle): Extract these constants. // TODO(juliatuttle): Extract these constants.
...@@ -298,8 +296,6 @@ TEST_F(NetworkErrorLoggingServiceTest, FailureReportQueued) { ...@@ -298,8 +296,6 @@ TEST_F(NetworkErrorLoggingServiceTest, FailureReportQueued) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
// TODO(juliatuttle): Extract these constants. // TODO(juliatuttle): Extract these constants.
...@@ -336,8 +332,6 @@ TEST_F(NetworkErrorLoggingServiceTest, HttpErrorReportQueued) { ...@@ -336,8 +332,6 @@ TEST_F(NetworkErrorLoggingServiceTest, HttpErrorReportQueued) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
// TODO(juliatuttle): Extract these constants. // TODO(juliatuttle): Extract these constants.
...@@ -375,8 +369,6 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessReportDowngraded) { ...@@ -375,8 +369,6 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessReportDowngraded) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
ExpectDictDoubleValue(1.0, *body, ExpectDictDoubleValue(1.0, *body,
...@@ -413,8 +405,6 @@ TEST_F(NetworkErrorLoggingServiceTest, FailureReportDowngraded) { ...@@ -413,8 +405,6 @@ TEST_F(NetworkErrorLoggingServiceTest, FailureReportDowngraded) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
ExpectDictDoubleValue(1.0, *body, ExpectDictDoubleValue(1.0, *body,
...@@ -451,8 +441,6 @@ TEST_F(NetworkErrorLoggingServiceTest, HttpErrorReportDowngraded) { ...@@ -451,8 +441,6 @@ TEST_F(NetworkErrorLoggingServiceTest, HttpErrorReportDowngraded) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
ExpectDictDoubleValue(1.0, *body, ExpectDictDoubleValue(1.0, *body,
...@@ -489,8 +477,6 @@ TEST_F(NetworkErrorLoggingServiceTest, DNSFailureReportNotDowngraded) { ...@@ -489,8 +477,6 @@ TEST_F(NetworkErrorLoggingServiceTest, DNSFailureReportNotDowngraded) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
ExpectDictDoubleValue(1.0, *body, ExpectDictDoubleValue(1.0, *body,
...@@ -526,8 +512,6 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessPOSTReportQueued) { ...@@ -526,8 +512,6 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessPOSTReportQueued) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body)); ASSERT_TRUE(reports()[0].body->GetAsDictionary(&body));
base::ExpectDictStringValue(kUrl_.spec(), *body,
NetworkErrorLoggingService::kUriKey);
base::ExpectDictStringValue(kReferrer_.spec(), *body, base::ExpectDictStringValue(kReferrer_.spec(), *body,
NetworkErrorLoggingService::kReferrerKey); NetworkErrorLoggingService::kReferrerKey);
ExpectDictDoubleValue(1.0, *body, ExpectDictDoubleValue(1.0, *body,
......
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