From 5fd26a7da152e6d7f1b102a4fdffe8b0859f9106 Mon Sep 17 00:00:00 2001 From: John Wilander Date: Wed, 9 Dec 2020 21:24:40 +0000 Subject: [PATCH] PCM: Make JSON key names use underscores according to the W3C conversation https://bugs.webkit.org/show_bug.cgi?id=219696 Reviewed by Brent Fulgham. Further discussion in https://github.com/privacycg/private-click-measurement/issues/30 concluded that the JSON report should use underscores in its keys instead of dashes. This patch makes that change and shortens the "report_version" key to just "version". Source/WebCore: Existing tests updated. * loader/PrivateClickMeasurement.cpp: (WebCore::PrivateClickMeasurement::json const): Tools: * TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp: (TestWebKitAPI::TEST): LayoutTests: * http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start-expected.txt: * http/tests/privateClickMeasurement/send-attribution-conversion-request-expected.txt: Canonical link: https://commits.webkit.org/232267@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270598 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 15 +++++++++++++++ ...port-gets-sent-on-session-start-expected.txt | 2 +- ...-attribution-conversion-request-expected.txt | 2 +- Source/WebCore/ChangeLog | 17 +++++++++++++++++ .../WebCore/loader/PrivateClickMeasurement.cpp | 12 ++++++------ Tools/ChangeLog | 15 +++++++++++++++ .../Tests/WebCore/PrivateClickMeasurement.cpp | 6 +++--- 7 files changed, 58 insertions(+), 11 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index ddd57e356fcb..94ea0e2f3339 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,18 @@ +2020-12-09 John Wilander + + PCM: Make JSON key names use underscores according to the W3C conversation + https://bugs.webkit.org/show_bug.cgi?id=219696 + + + Reviewed by Brent Fulgham. + + Further discussion in https://github.com/privacycg/private-click-measurement/issues/30 + concluded that the JSON report should use underscores in its keys instead of dashes. + This patch makes that change and shortens the "report_version" key to just "version". + + * http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start-expected.txt: + * http/tests/privateClickMeasurement/send-attribution-conversion-request-expected.txt: + 2020-12-09 Antti Koivisto Font loads are triggered too late diff --git a/LayoutTests/http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start-expected.txt b/LayoutTests/http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start-expected.txt index 460cc6f707d4..7f9c3ef4446b 100644 --- a/LayoutTests/http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start-expected.txt +++ b/LayoutTests/http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start-expected.txt @@ -11,7 +11,7 @@ Content type: application/json REQUEST_URI: /privateClickMeasurement/resources/conversionReport.php No cookies in attribution request. Request body: -{"source-engagement-type":"click","source-site":"127.0.0.1","source-id":3,"attributed-on-site":"localhost","trigger-data":12,"report-version":1} +{"source_engagement_type":"click","source_site":"127.0.0.1","source_id":3,"attributed_on_site":"localhost","trigger_data":12,"version":1} No stored Private Click Measurement data. diff --git a/LayoutTests/http/tests/privateClickMeasurement/send-attribution-conversion-request-expected.txt b/LayoutTests/http/tests/privateClickMeasurement/send-attribution-conversion-request-expected.txt index de4b533d8890..e2066c464934 100644 --- a/LayoutTests/http/tests/privateClickMeasurement/send-attribution-conversion-request-expected.txt +++ b/LayoutTests/http/tests/privateClickMeasurement/send-attribution-conversion-request-expected.txt @@ -16,7 +16,7 @@ Content type: application/json REQUEST_URI: /privateClickMeasurement/resources/conversionReport.php No cookies in attribution request. Request body: -{"source-engagement-type":"click","source-site":"127.0.0.1","source-id":3,"attributed-on-site":"localhost","trigger-data":12,"report-version":1} +{"source_engagement_type":"click","source_site":"127.0.0.1","source_id":3,"attributed_on_site":"localhost","trigger_data":12,"version":1} -------- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 87797079072f..9701a15de06b 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2020-12-09 John Wilander + + PCM: Make JSON key names use underscores according to the W3C conversation + https://bugs.webkit.org/show_bug.cgi?id=219696 + + + Reviewed by Brent Fulgham. + + Further discussion in https://github.com/privacycg/private-click-measurement/issues/30 + concluded that the JSON report should use underscores in its keys instead of dashes. + This patch makes that change and shortens the "report_version" key to just "version". + + Existing tests updated. + + * loader/PrivateClickMeasurement.cpp: + (WebCore::PrivateClickMeasurement::json const): + 2020-12-09 Antoine Quint text-decoration-color animation should not be discrete diff --git a/Source/WebCore/loader/PrivateClickMeasurement.cpp b/Source/WebCore/loader/PrivateClickMeasurement.cpp index 4e641e64a2ce..2afdc445c102 100644 --- a/Source/WebCore/loader/PrivateClickMeasurement.cpp +++ b/Source/WebCore/loader/PrivateClickMeasurement.cpp @@ -160,12 +160,12 @@ Ref PrivateClickMeasurement::json() const if (!m_attributionTriggerData || !isValid()) return reportDetails; - reportDetails->setString("source-engagement-type"_s, "click"_s); - reportDetails->setString("source-site"_s, m_sourceSite.registrableDomain.string()); - reportDetails->setInteger("source-id"_s, m_sourceID.id); - reportDetails->setString("attributed-on-site"_s, m_attributeOnSite.registrableDomain.string()); - reportDetails->setInteger("trigger-data"_s, m_attributionTriggerData->data); - reportDetails->setInteger("report-version"_s, 1); + reportDetails->setString("source_engagement_type"_s, "click"_s); + reportDetails->setString("source_site"_s, m_sourceSite.registrableDomain.string()); + reportDetails->setInteger("source_id"_s, m_sourceID.id); + reportDetails->setString("attributed_on_site"_s, m_attributeOnSite.registrableDomain.string()); + reportDetails->setInteger("trigger_data"_s, m_attributionTriggerData->data); + reportDetails->setInteger("version"_s, 1); return reportDetails; } diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 459a301067f0..5cb1efd355df 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,18 @@ +2020-12-09 John Wilander + + PCM: Make JSON key names use underscores according to the W3C conversation + https://bugs.webkit.org/show_bug.cgi?id=219696 + + + Reviewed by Brent Fulgham. + + Further discussion in https://github.com/privacycg/private-click-measurement/issues/30 + concluded that the JSON report should use underscores in its keys instead of dashes. + This patch makes that change and shortens the "report_version" key to just "version". + + * TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp: + (TestWebKitAPI::TEST): + 2020-12-09 Alex Christensen Make PDFHUD.MoveIFrame API test more robust diff --git a/Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp b/Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp index 2ec0a0a3efe3..070b33a4baed 100644 --- a/Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp +++ b/Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp @@ -50,7 +50,7 @@ TEST(PrivateClickMeasurement, ValidMinValues) ASSERT_EQ(attributionURL.string(), "https://webkit.org/.well-known/private-click-measurement/"); - ASSERT_EQ(attribution.json()->toJSONString(), "{\"source-engagement-type\":\"click\",\"source-site\":\"webkit.org\",\"source-id\":0,\"attributed-on-site\":\"example.com\",\"trigger-data\":0,\"report-version\":1}"); + ASSERT_EQ(attribution.json()->toJSONString(), "{\"source_engagement_type\":\"click\",\"source_site\":\"webkit.org\",\"source_id\":0,\"attributed_on_site\":\"example.com\",\"trigger_data\":0,\"version\":1}"); } TEST(PrivateClickMeasurement, ValidMidValues) @@ -62,7 +62,7 @@ TEST(PrivateClickMeasurement, ValidMidValues) ASSERT_EQ(attributionURL.string(), "https://webkit.org/.well-known/private-click-measurement/"); - ASSERT_EQ(attribution.json()->toJSONString(), "{\"source-engagement-type\":\"click\",\"source-site\":\"webkit.org\",\"source-id\":192,\"attributed-on-site\":\"example.com\",\"trigger-data\":9,\"report-version\":1}"); + ASSERT_EQ(attribution.json()->toJSONString(), "{\"source_engagement_type\":\"click\",\"source_site\":\"webkit.org\",\"source_id\":192,\"attributed_on_site\":\"example.com\",\"trigger_data\":9,\"version\":1}"); } TEST(PrivateClickMeasurement, ValidMaxValues) @@ -74,7 +74,7 @@ TEST(PrivateClickMeasurement, ValidMaxValues) ASSERT_EQ(attributionURL.string(), "https://webkit.org/.well-known/private-click-measurement/"); - ASSERT_EQ(attribution.json()->toJSONString(), "{\"source-engagement-type\":\"click\",\"source-site\":\"webkit.org\",\"source-id\":255,\"attributed-on-site\":\"example.com\",\"trigger-data\":15,\"report-version\":1}"); + ASSERT_EQ(attribution.json()->toJSONString(), "{\"source_engagement_type\":\"click\",\"source_site\":\"webkit.org\",\"source_id\":255,\"attributed_on_site\":\"example.com\",\"trigger_data\":15,\"version\":1}"); } TEST(PrivateClickMeasurement, EarliestTimeToSendAttributionMinimumDelay)