-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PCM: Add capability for click destination to fire triggering event wi…
…thout cross-site requests to the click source https://bugs.webkit.org/show_bug.cgi?id=233173 <rdar://79426605> Reviewed by Alex Christensen. Source/WebCore: This patch enables click destination sites a non-JavaScript way to fire triggering events without a requirement to make cross-site requests to source sites. This is referred to as a "same-site pixel API" and has been discussed in W3C Privacy CG: privacycg/private-click-measurement#71 The reason why some merchants want such an "API" is reluctance to deploy new JavaScript on their sites. In some industries it's even a compliance issue. Legacy "pixels" are however accepted and so a same-site "pixel" can work for them. Test: http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive.html * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::handleClick): This change is because of clarification in naming: - attributionReportSourceURL to attributionReportClickSourceURL * loader/PrivateClickMeasurement.cpp: (WebCore::PrivateClickMeasurement::parseAttributionRequestQuery): New function that parses out query string parameters. (WebCore::PrivateClickMeasurement::parseAttributionRequest): Now calls the new PrivateClickMeasurement::parseAttributionRequestQuery() which handles data coming in in query parameters, in this case the new parameter "attributionSource." (WebCore::PrivateClickMeasurement::attributionReportClickSourceURL const): New name. (WebCore::PrivateClickMeasurement::attributionReportClickDestinationURL const): New name. (WebCore::PrivateClickMeasurement::attributionReportJSON const): Now uses the constant privateClickMeasurementVersion. (WebCore::PrivateClickMeasurement::tokenSignatureJSON const): Now uses the constant privateClickMeasurementVersion. (WebCore::PrivateClickMeasurement::attributionReportSourceURL const): Deleted. Renamed attributionReportClickSourceURL. (WebCore::PrivateClickMeasurement::attributionReportAttributeOnURL const): Deleted. Renamed attributionReportClickDestinationURL. * loader/PrivateClickMeasurement.h: (WebCore::PrivateClickMeasurement::sourceSecretToken const): New name. (WebCore::PrivateClickMeasurement::AttributionTriggerData::encode const): (WebCore::PrivateClickMeasurement::AttributionTriggerData::decode): Encoding and decoding of the new field sourceRegistrableDomain. (WebCore::PrivateClickMeasurement::sourceUnlinkableToken const): Deleted. Renamed sourceSecretToken. Note that it was always the secret token used, just bad renaming earlier. Source/WebKit: This patch enables click destination sites a non-JavaScript way to fire triggering events without a requirement to make cross-site requests to source sites. This is referred to as a "same-site pixel API" and has been discussed in W3C Privacy CG: privacycg/private-click-measurement#71 The reason why some merchants want such an "API" is reluctance to deploy new JavaScript on their sites. In some industries it's even a compliance issue. Legacy "pixels" are however accepted and so a same-site "pixel" can work for them. * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementDatabase.cpp: (WebKit::PCM::Database::insertPrivateClickMeasurement): These changes are just a correction of a function name: - sourceUnlinkableToken() to sourceSecretToken() Note that it was always the secret token used, just bad renaming earlier. * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.cpp: (WebKit::PrivateClickMeasurementManager::handleAttribution): Now checks if the incoming WebCore::PrivateClickMeasurement::AttributionTriggerData carries a sourceRegistrableDomain. If so, it accepts that domain as the source site for attribution if the triggering event was same-site as the first-party. (WebKit::PrivateClickMeasurementManager::attribute): (WebKit::PrivateClickMeasurementManager::fireConversionRequest): These changes are just a correction of a function name: - sourceUnlinkableToken() to sourceSecretToken() Note that it was always the secret token used, just bad renaming earlier. (WebKit::PrivateClickMeasurementManager::fireConversionRequestImpl): These changes are because of clarification in naming: - attributionReportSourceURL to attributionReportClickSourceURL - attributionReportAttributeOnURL to attributionReportClickDestinationURL * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementManager.h: * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.cpp: (WebKit::PCM::Store::attributePrivateClickMeasurement): * NetworkProcess/PrivateClickMeasurement/PrivateClickMeasurementStore.h: Source/WTF: * wtf/URL.cpp: (WTF::queryParameters): New convenience getter. * wtf/URL.h: Tools: These changes are just a correction of a function name: sourceUnlinkableToken() to sourceSecretToken() * TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp: (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebCore/cocoa/PrivateClickMeasurementCocoa.mm: (TestWebKitAPI::TEST): LayoutTests: * http/tests/privateClickMeasurement/resources/redirectToConversionWithAttributionSource.py: Added. * http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive-expected.txt: Added. * http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive.html: Added. Canonical link: https://commits.webkit.org/244367@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
477430c
commit c1c5ecb
Showing
20 changed files
with
344 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
2021-11-17 John Wilander <[email protected]> | ||
|
||
PCM: Add capability for click destination to fire triggering event without cross-site requests to the click source | ||
https://bugs.webkit.org/show_bug.cgi?id=233173 | ||
<rdar://79426605> | ||
|
||
Reviewed by Alex Christensen. | ||
|
||
* http/tests/privateClickMeasurement/resources/redirectToConversionWithAttributionSource.py: Added. | ||
* http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive-expected.txt: Added. | ||
* http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive.html: Added. | ||
|
||
2021-11-17 Ryan Haddad <[email protected]> | ||
|
||
[iOS] imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_window_open_download_block_downloads.tentative.html is frequently failing | ||
|
29 changes: 29 additions & 0 deletions
29
...http/tests/privateClickMeasurement/resources/redirectToConversionWithAttributionSource.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
import time | ||
from urllib.parse import parse_qs | ||
|
||
query = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True) | ||
delay_ms = query.get('delay_ms', [None])[0] | ||
conversion_data = query.get('conversionData', [None])[0] | ||
priority = query.get('priority', [None])[0] | ||
|
||
if delay_ms is not None: | ||
time.sleep(int(delay_ms) * 0.001) | ||
|
||
sys.stdout.write( | ||
'status: 302\r\n' | ||
'Cache-Control: no-cache, no-store, must-revalidate\r\n' | ||
'Access-Control-Allow-Origin: *\r\n' | ||
'Access-Control-Allow-Methods: GET\r\n' | ||
'Content-Type: text/html\r\n' | ||
) | ||
|
||
if conversion_data is not None and priority is not None: | ||
sys.stdout.write('Location: /.well-known/private-click-measurement/trigger-attribution/{}/{}?attributionSource=https://127.0.0.1\r\n'.format(conversion_data, priority)) | ||
elif conversion_data is not None: | ||
sys.stdout.write('Location: /.well-known/private-click-measurement/trigger-attribution/{}?attributionSource=https://127.0.0.1\r\n'.format(conversion_data)) | ||
|
||
sys.stdout.write('\r\n') |
15 changes: 15 additions & 0 deletions
15
...Measurement/triggering-event-with-attribution-source-through-fetch-keepalive-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CONSOLE MESSAGE: [Private Click Measurement] Conversion was not accepted because the conversion data could not be parsed or was higher than the allowed maximum of 15. | ||
CONSOLE MESSAGE: Origin http://localhost:8000 is not allowed by Access-Control-Allow-Origin. Status code: 404 | ||
CONSOLE MESSAGE: Fetch API cannot load https://localhost:8443/.well-known/private-click-measurement/trigger-attribution/Dummy?attributionSource=https://127.0.0.1 due to access control checks. | ||
Tests triggering of private click measurement attribution with same-site triggering event request. | ||
|
||
|
||
Attributed Private Click Measurements: | ||
WebCore::PrivateClickMeasurement 1 | ||
Source site: 127.0.0.1 | ||
Attribute on site: localhost | ||
Source ID: 3 | ||
Attribution trigger data: 12 | ||
Attribution priority: 0 | ||
Attribution earliest time to send: Within 24-48 hours | ||
Application bundle identifier: testBundleID |
55 changes: 55 additions & 0 deletions
55
...ateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<script src="/js-test-resources/ui-helper.js"></script> | ||
<script src="resources/util.js"></script> | ||
</head> | ||
<body onload="runTest()"> | ||
<div id="description">Tests triggering of private click measurement attribution with same-site triggering event request.</div> | ||
<a id="targetLink" href="http://localhost:8000/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive.html?stepTwo" attributionsourceid=3 attributiondestination="http://localhost:8000">Link</a><br> | ||
<div id="output"></div> | ||
<script> | ||
prepareTest(); | ||
|
||
function activateElement(elementID) { | ||
var element = document.getElementById(elementID); | ||
var centerX = element.offsetLeft + element.offsetWidth / 2; | ||
var centerY = element.offsetTop + element.offsetHeight / 2; | ||
UIHelper.activateAt(centerX, centerY).then( | ||
function () { | ||
}, | ||
function () { | ||
document.getElementById("output").innerText = "FAIL Promise rejected."; | ||
tearDownAndFinish(); | ||
} | ||
); | ||
} | ||
|
||
function triggerFetch(conversionData) { | ||
return fetch("https://localhost:8443/privateClickMeasurement/resources/redirectToConversionWithAttributionSource.py?conversionData="+ conversionData + "&delay_ms=100", { keepalive: true }); | ||
} | ||
|
||
function runTest() { | ||
if (window.location.search === "?stepTwo") { | ||
// Start private click attribution fetch but navigate away before the fetch redirection happens. | ||
triggerFetch(12); | ||
document.location.href = "http://localhost:8000/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive.html?stepThree"; | ||
return; | ||
} | ||
if (window.location.search === "?stepThree") { | ||
document.body.removeChild(document.getElementById("targetLink")); | ||
// Do an invalid private click attribution fetch to ensure the previous correct click attribution fetch will be finished. | ||
triggerFetch("Dummy").catch(() => { | ||
if (window.testRunner) | ||
testRunner.dumpPrivateClickMeasurement(); | ||
tearDownAndFinish(); | ||
}); | ||
return; | ||
} | ||
testRunner.setPrivateClickMeasurementAppBundleIDForTesting("testBundleID"); | ||
activateElement("targetLink"); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
2021-11-17 John Wilander <[email protected]> | ||
|
||
PCM: Add capability for click destination to fire triggering event without cross-site requests to the click source | ||
https://bugs.webkit.org/show_bug.cgi?id=233173 | ||
<rdar://79426605> | ||
|
||
Reviewed by Alex Christensen. | ||
|
||
* wtf/URL.cpp: | ||
(WTF::queryParameters): | ||
New convenience getter. | ||
* wtf/URL.h: | ||
|
||
2021-11-17 Chris Dumez <[email protected]> | ||
|
||
Web Locks API does get enabled in Service Workers when running layout tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,55 @@ | ||
2021-11-17 John Wilander <[email protected]> | ||
|
||
PCM: Add capability for click destination to fire triggering event without cross-site requests to the click source | ||
https://bugs.webkit.org/show_bug.cgi?id=233173 | ||
<rdar://79426605> | ||
|
||
Reviewed by Alex Christensen. | ||
|
||
This patch enables click destination sites a non-JavaScript way to fire triggering | ||
events without a requirement to make cross-site requests to source sites. This is | ||
referred to as a "same-site pixel API" and has been discussed in W3C Privacy CG: | ||
https://github.com/privacycg/private-click-measurement/issues/71 | ||
|
||
The reason why some merchants want such an "API" is reluctance to deploy new | ||
JavaScript on their sites. In some industries it's even a compliance issue. Legacy | ||
"pixels" are however accepted and so a same-site "pixel" can work for them. | ||
|
||
Test: http/tests/privateClickMeasurement/triggering-event-with-attribution-source-through-fetch-keepalive.html | ||
|
||
* html/HTMLAnchorElement.cpp: | ||
(WebCore::HTMLAnchorElement::handleClick): | ||
This change is because of clarification in naming: | ||
- attributionReportSourceURL to attributionReportClickSourceURL | ||
* loader/PrivateClickMeasurement.cpp: | ||
(WebCore::PrivateClickMeasurement::parseAttributionRequestQuery): | ||
New function that parses out query string parameters. | ||
(WebCore::PrivateClickMeasurement::parseAttributionRequest): | ||
Now calls the new PrivateClickMeasurement::parseAttributionRequestQuery() | ||
which handles data coming in in query parameters, in this case | ||
the new parameter "attributionSource." | ||
(WebCore::PrivateClickMeasurement::attributionReportClickSourceURL const): | ||
New name. | ||
(WebCore::PrivateClickMeasurement::attributionReportClickDestinationURL const): | ||
New name. | ||
(WebCore::PrivateClickMeasurement::attributionReportJSON const): | ||
Now uses the constant privateClickMeasurementVersion. | ||
(WebCore::PrivateClickMeasurement::tokenSignatureJSON const): | ||
Now uses the constant privateClickMeasurementVersion. | ||
(WebCore::PrivateClickMeasurement::attributionReportSourceURL const): Deleted. | ||
Renamed attributionReportClickSourceURL. | ||
(WebCore::PrivateClickMeasurement::attributionReportAttributeOnURL const): Deleted. | ||
Renamed attributionReportClickDestinationURL. | ||
* loader/PrivateClickMeasurement.h: | ||
(WebCore::PrivateClickMeasurement::sourceSecretToken const): | ||
New name. | ||
(WebCore::PrivateClickMeasurement::AttributionTriggerData::encode const): | ||
(WebCore::PrivateClickMeasurement::AttributionTriggerData::decode): | ||
Encoding and decoding of the new field sourceRegistrableDomain. | ||
(WebCore::PrivateClickMeasurement::sourceUnlinkableToken const): Deleted. | ||
Renamed sourceSecretToken. | ||
Note that it was always the secret token used, just bad renaming earlier. | ||
|
||
2021-11-17 Tim Horton <[email protected]> | ||
|
||
Momentum animator: Short scrolls are too far, medium scrolls aren't far enough | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.