forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PCM: Allow measurement of links in nested, cross-site iframes
https://bugs.webkit.org/show_bug.cgi?id=229204 <rdar://problem/82310386> Reviewed by Alex Christensen. Developers have said it would be great to allow measurement of links served in nested, cross-site iframes on the click source. The click still count as if it happened on the first party click source site, and any attribution report still goes to that first party. This change enables the *serving* of measurable links in nested, cross-site iframes. The standards issue where this was discussed: privacycg/private-click-measurement#7 Source/WebCore: Test: http/tests/privateClickMeasurement/store-private-click-measurement-nested.html * html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::parsePrivateClickMeasurement const): Removed the block for nested, cross-site iframes. LayoutTests: * http/tests/privateClickMeasurement/resources/nestedTargetLink.html: Added. * http/tests/privateClickMeasurement/store-private-click-measurement-nested-expected.txt: Added. * http/tests/privateClickMeasurement/store-private-click-measurement-nested.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@283593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
wilander@apple.com
committed
Oct 6, 2021
1 parent
7007bd3
commit 6745529
Showing
6 changed files
with
130 additions
and
10 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
10 changes: 10 additions & 0 deletions
10
LayoutTests/http/tests/privateClickMeasurement/resources/nestedTargetLink.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,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Nested target link</title> | ||
</head> | ||
<body> | ||
<a style="font-size: xxx-large;" target="_top" href="http://localhost:8000/privateClickMeasurement/store-private-click-measurement-nested.html?stepTwo" attributionsourceid="3" attributiondestination="http://localhost:8000">Link</a><br> | ||
</body> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
...ts/http/tests/privateClickMeasurement/store-private-click-measurement-nested-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,9 @@ | ||
Tests storage of private click measurement with nested links. | ||
|
||
Unattributed Private Click Measurements: | ||
WebCore::PrivateClickMeasurement 1 | ||
Source site: 127.0.0.1 | ||
Attribute on site: localhost | ||
Source ID: 3 | ||
No attribution trigger data. | ||
Application bundle identifier: testBundleID |
55 changes: 55 additions & 0 deletions
55
LayoutTests/http/tests/privateClickMeasurement/store-private-click-measurement-nested.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> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
<script src="resources/util.js"></script> | ||
<script src="/js-test-resources/ui-helper.js"></script> | ||
</head> | ||
<body onload="setTimeout(runTest, 0)"> | ||
<div id="description">Tests storage of private click measurement with nested links.</div> | ||
<div id="output"></div> | ||
<script> | ||
prepareTest(); | ||
|
||
function activateLink() { | ||
let element = document.getElementById("targetFrame"); | ||
let centerX = element.offsetLeft + element.offsetWidth / 2; | ||
let centerY = element.offsetTop + element.offsetHeight / 2; | ||
if (!UIHelper) { | ||
document.getElementById("output").innerText = "FAIL No UIHelper."; | ||
tearDownAndFinish(); | ||
} | ||
UIHelper.activateAt(centerX, centerY).then( | ||
function () { | ||
}, | ||
function () { | ||
document.getElementById("output").innerText = "FAIL Promise rejected."; | ||
} | ||
); | ||
} | ||
|
||
function runTest() { | ||
if (window.testRunner) { | ||
if (window.location.search === "?stepTwo") { | ||
testRunner.dumpPrivateClickMeasurement(); | ||
testRunner.setPrivateClickMeasurementAppBundleIDForTesting(""); | ||
tearDownAndFinish(); | ||
} else { | ||
testRunner.setPrivateClickMeasurementAppBundleIDForTesting("testBundleID"); | ||
let iframeElement = document.createElement("iframe"); | ||
iframeElement.setAttribute("sandbox", "allow-scripts allow-top-navigation"); | ||
iframeElement.id = "targetFrame"; | ||
iframeElement.width = "50px"; | ||
iframeElement.height = "50px"; | ||
iframeElement.onload = activateLink; | ||
iframeElement.src = "http://localhost:8000/privateClickMeasurement/resources/nestedTargetLink.html"; | ||
document.body.appendChild(iframeElement); | ||
} | ||
} else { | ||
document.getElementById("output").innerText = "FAIL No testRunner."; | ||
} | ||
} | ||
</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
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