Diff
Modified: branches/safari-611-branch/LayoutTests/ChangeLog (272536 => 272537)
--- branches/safari-611-branch/LayoutTests/ChangeLog 2021-02-08 21:04:02 UTC (rev 272536)
+++ branches/safari-611-branch/LayoutTests/ChangeLog 2021-02-08 21:04:06 UTC (rev 272537)
@@ -1,5 +1,50 @@
2021-02-08 Russell Epstein <[email protected]>
+ Cherry-pick r272422. rdar://problem/74033021
+
+ Make sure click attribution is processed in case of redirected kept alive loads
+ https://bugs.webkit.org/show_bug.cgi?id=221453
+ <rdar://problem/70896640>
+
+ Reviewed by John Wilander.
+
+ Source/WebCore:
+
+ Test: http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::addSubresourceLoader):
+ Update assertion to cope with keep alive fetches which are similar to beacon/ping loads.
+
+ Source/WebKit:
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
+ Move the click attribution processing before kept alive check.
+
+ LayoutTests:
+
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt: Added.
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html: Added.
+ * http/tests/privateClickMeasurement/resources/redirectToConversion.php:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-02-05 Youenn Fablet <[email protected]>
+
+ Make sure click attribution is processed in case of redirected kept alive loads
+ https://bugs.webkit.org/show_bug.cgi?id=221453
+ <rdar://problem/70896640>
+
+ Reviewed by John Wilander.
+
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt: Added.
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html: Added.
+ * http/tests/privateClickMeasurement/resources/redirectToConversion.php:
+
+2021-02-08 Russell Epstein <[email protected]>
+
Cherry-pick r272368. rdar://problem/74032667
[macOS] Selecting a date on datetime-local inputs unexpectedly adds second and millisecond fields
Added: branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt (0 => 272537)
--- branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt (rev 0)
+++ branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt 2021-02-08 21:04:06 UTC (rev 272537)
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: [Private Click Measurement] Conversion was not accepted because the URL path contained unrecognized parts.
+CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin.
+CONSOLE MESSAGE: Fetch API cannot load https://127.0.0.1:8443/.well-known/private-click-measurement/trigger-attribution/whatever due to access control checks.
+Tests triggering of private click measurement attributions with fetch on pagehide.
+
+
+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
Added: branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html (0 => 272537)
--- branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html (rev 0)
+++ branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html 2021-02-08 21:04:06 UTC (rev 272537)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <script src=""
+ <script src=""
+</head>
+<body _onload_="runTest()">
+<div id="description">Tests triggering of private click measurement attributions with fetch on pagehide.</div>
+<a id="targetLink" href="" attributionsourceid="3" attributeon="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://127.0.0.1:8443/privateClickMeasurement/resources/redirectToConversion.php?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 = ""
+ 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("whatever").catch(() => {
+ if (window.testRunner)
+ testRunner.dumpPrivateClickMeasurement();
+ tearDownAndFinish();
+ });
+ return;
+ }
+ activateElement("targetLink");
+ }
+</script>
+</body>
+</html>
Modified: branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/resources/redirectToConversion.php (272536 => 272537)
--- branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/resources/redirectToConversion.php 2021-02-08 21:04:02 UTC (rev 272536)
+++ branches/safari-611-branch/LayoutTests/http/tests/privateClickMeasurement/resources/redirectToConversion.php 2021-02-08 21:04:06 UTC (rev 272537)
@@ -1,6 +1,11 @@
<?php
+if (isset($_GET["delay_ms"])) {
+ usleep($_GET["delay_ms"] * 1000);
+}
header("HTTP/1.1 302 Found");
header("Cache-Control: no-cache, no-store, must-revalidate");
+header("Access-Control-Allow-Origin: *");
+header("Access-Control-Allow-Methods: GET");
if (isset($_GET["conversionData"]) && isset($_GET["priority"])) {
header("Location: /.well-known/private-click-measurement/trigger-attribution/" . $_GET["conversionData"] . "/" . $_GET["priority"]);
} else if (isset($_GET["conversionData"])) {
Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (272536 => 272537)
--- branches/safari-611-branch/Source/WebCore/ChangeLog 2021-02-08 21:04:02 UTC (rev 272536)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog 2021-02-08 21:04:06 UTC (rev 272537)
@@ -1,5 +1,52 @@
2021-02-08 Russell Epstein <[email protected]>
+ Cherry-pick r272422. rdar://problem/74033021
+
+ Make sure click attribution is processed in case of redirected kept alive loads
+ https://bugs.webkit.org/show_bug.cgi?id=221453
+ <rdar://problem/70896640>
+
+ Reviewed by John Wilander.
+
+ Source/WebCore:
+
+ Test: http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::addSubresourceLoader):
+ Update assertion to cope with keep alive fetches which are similar to beacon/ping loads.
+
+ Source/WebKit:
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
+ Move the click attribution processing before kept alive check.
+
+ LayoutTests:
+
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt: Added.
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html: Added.
+ * http/tests/privateClickMeasurement/resources/redirectToConversion.php:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-02-05 Youenn Fablet <[email protected]>
+
+ Make sure click attribution is processed in case of redirected kept alive loads
+ https://bugs.webkit.org/show_bug.cgi?id=221453
+ <rdar://problem/70896640>
+
+ Reviewed by John Wilander.
+
+ Test: http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::addSubresourceLoader):
+ Update assertion to cope with keep alive fetches which are similar to beacon/ping loads.
+
+2021-02-08 Russell Epstein <[email protected]>
+
Cherry-pick r272368. rdar://problem/74032667
[macOS] Selecting a date on datetime-local inputs unexpectedly adds second and millisecond fields
Modified: branches/safari-611-branch/Source/WebCore/loader/DocumentLoader.cpp (272536 => 272537)
--- branches/safari-611-branch/Source/WebCore/loader/DocumentLoader.cpp 2021-02-08 21:04:02 UTC (rev 272536)
+++ branches/safari-611-branch/Source/WebCore/loader/DocumentLoader.cpp 2021-02-08 21:04:06 UTC (rev 272537)
@@ -1819,7 +1819,7 @@
case Document::AboutToEnterBackForwardCache: {
// A page about to enter the BackForwardCache should only be able to start ping loads.
auto* cachedResource = MemoryCache::singleton().resourceForRequest(loader->request(), loader->frameLoader()->frame().page()->sessionID());
- ASSERT(cachedResource && CachedResource::shouldUsePingLoad(cachedResource->type()));
+ ASSERT(cachedResource && (CachedResource::shouldUsePingLoad(cachedResource->type()) || cachedResource->options().keepAlive));
break;
}
case Document::InBackForwardCache:
Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (272536 => 272537)
--- branches/safari-611-branch/Source/WebKit/ChangeLog 2021-02-08 21:04:02 UTC (rev 272536)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog 2021-02-08 21:04:06 UTC (rev 272537)
@@ -1,5 +1,50 @@
2021-02-08 Russell Epstein <[email protected]>
+ Cherry-pick r272422. rdar://problem/74033021
+
+ Make sure click attribution is processed in case of redirected kept alive loads
+ https://bugs.webkit.org/show_bug.cgi?id=221453
+ <rdar://problem/70896640>
+
+ Reviewed by John Wilander.
+
+ Source/WebCore:
+
+ Test: http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::addSubresourceLoader):
+ Update assertion to cope with keep alive fetches which are similar to beacon/ping loads.
+
+ Source/WebKit:
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
+ Move the click attribution processing before kept alive check.
+
+ LayoutTests:
+
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive-expected.txt: Added.
+ * http/tests/privateClickMeasurement/attribution-conversion-through-fetch-keepalive.html: Added.
+ * http/tests/privateClickMeasurement/resources/redirectToConversion.php:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-02-05 Youenn Fablet <[email protected]>
+
+ Make sure click attribution is processed in case of redirected kept alive loads
+ https://bugs.webkit.org/show_bug.cgi?id=221453
+ <rdar://problem/70896640>
+
+ Reviewed by John Wilander.
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
+ Move the click attribution processing before kept alive check.
+
+2021-02-08 Russell Epstein <[email protected]>
+
Cherry-pick r272376. rdar://problem/74032694
REGRESSION(r267763) Network process launches earlier than before
Modified: branches/safari-611-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (272536 => 272537)
--- branches/safari-611-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2021-02-08 21:04:02 UTC (rev 272536)
+++ branches/safari-611-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp 2021-02-08 21:04:06 UTC (rev 272537)
@@ -877,15 +877,15 @@
RELEASE_LOG_IF_ALLOWED("continueWillSendRedirectedRequest: (m_isKeptAlive=%d, hasAdClickConversion=%d)", m_isKeptAlive, !!privateClickMeasurementAttributionTriggerData);
ASSERT(!isSynchronous());
+ NetworkSession* networkSession = nullptr;
+ if (privateClickMeasurementAttributionTriggerData && (networkSession = m_connection->networkProcess().networkSession(sessionID())))
+ networkSession->handlePrivateClickMeasurementConversion(WTFMove(*privateClickMeasurementAttributionTriggerData), request.url(), redirectRequest);
+
if (m_isKeptAlive) {
continueWillSendRequest(WTFMove(redirectRequest), false);
return;
}
- NetworkSession* networkSession = nullptr;
- if (privateClickMeasurementAttributionTriggerData && (networkSession = m_connection->networkProcess().networkSession(sessionID())))
- networkSession->handlePrivateClickMeasurementConversion(WTFMove(*privateClickMeasurementAttributionTriggerData), request.url(), redirectRequest);
-
// We send the request body separately because the ResourceRequest body normally does not get encoded when sent over IPC, as an optimization.
// However, we really need the body here because a redirect cross-site may cause a process-swap and the request to start again in a new WebContent process.
send(Messages::WebResourceLoader::WillSendRequest(redirectRequest, IPC::FormDataReference { redirectRequest.httpBody() }, sanitizeResponseIfPossible(WTFMove(redirectResponse), ResourceResponse::SanitizationType::Redirection)));