<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[243097] branches/safari-607-branch</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/243097">243097</a></dd>
<dt>Author</dt> <dd>kocsen_chung@apple.com</dd>
<dt>Date</dt> <dd>2019-03-18 13:56:41 -0700 (Mon, 18 Mar 2019)</dd>
</dl>
<h3>Log Message</h3>
<pre>Apply patch. rdar://problem/48839387</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari607branchLayoutTestsChangeLog">branches/safari-607-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjshtml">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html</a></li>
<li><a href="#branchessafari607branchSourceWebCoreChangeLog">branches/safari-607-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari607branchSourceWebCoreplatformnetworkNetworkStorageSessioncpp">branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebCoreplatformnetworkNetworkStorageSessionh">branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.h</a></li>
<li><a href="#branchessafari607branchSourceWebCoreplatformnetworkcocoaNetworkStorageSessionCocoamm">branches/safari-607-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm</a></li>
<li><a href="#branchessafari607branchSourceWebKitChangeLog">branches/safari-607-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari607branchSourceWebKitNetworkProcessNetworkConnectionToWebProcesscpp">branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitNetworkProcessNetworkConnectionToWebProcessh">branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h</a></li>
<li><a href="#branchessafari607branchSourceWebKitNetworkProcessNetworkConnectionToWebProcessmessagesin">branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in</a></li>
<li><a href="#branchessafari607branchSourceWebKitNetworkProcessNetworkProcesscpp">branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitNetworkProcessNetworkProcessh">branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#branchessafari607branchSourceWebKitNetworkProcessNetworkProcessmessagesin">branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.messages.in</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessAPICWKWebsiteDataStoreRefcpp">branches/safari-607-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessNetworkNetworkProcessProxycpp">branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessNetworkNetworkProcessProxyh">branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessResourceLoadStatisticsMemoryStorecpp">branches/safari-607-branch/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessWebPageProxycpp">branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessWebProcessPoolcpp">branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp">branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
<li><a href="#branchessafari607branchSourceWebKitUIProcessWebsiteDataWebsiteDataStoreh">branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h</a></li>
<li><a href="#branchessafari607branchSourceWebKitWebProcessWebPageWebPagecpp">branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkdecorationsamesiteexpectedtxt">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkdecorationsamesitehtml">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkfragmentfromprevalentresourceexpectedtxt">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkfragmentfromprevalentresourcehtml">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryandfragmentfromprevalentresourceexpectedtxt">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryandfragmentfromprevalentresourcehtml">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryfromprevalentresourceexpectedtxt">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryfromprevalentresourcehtml">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithoutlinkdecorationfromprevalentresourceexpectedtxt">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt</a></li>
<li><a href="#branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithoutlinkdecorationfromprevalentresourcehtml">branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari607branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/LayoutTests/ChangeLog (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/ChangeLog 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/LayoutTests/ChangeLog 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2019-03-18 Kocsen Chung <kocsen_chung@apple.com>
+
+ Apply patch. rdar://problem/48839387
+
+ 2019-03-18 John Wilander <wilander@apple.com>
+
+ Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration (branch patch)
+ https://bugs.webkit.org/show_bug.cgi?id=195711
+ <rdar://problem/48839387>
+ <rdar://problem/48832278>
+
+ Reviewed by Brent Fulgham.
+
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html: Added.
+ * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html:
+
</ins><span class="cx"> 2019-03-13 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Cherry-pick r242749. rdar://problem/48839358
</span></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkdecorationsamesiteexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Check that cookies created by JavaScript after a same-site navigation with link decoration don't get capped to 24 hours.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS The two long-lived cookies expire after more than 86430 seconds.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkdecorationsamesitehtml"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/js-test-resources/js-test.js"></script>
+ <script src="/cookies/resources/cookie-utilities.js"></script>
+ <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout('runTest()', 0)">
+<script>
+ description("Check that cookies created by JavaScript after a same-site navigation with link decoration don't get capped to 24 hours.");
+ jsTestIsAsync = true;
+
+ function testCookies() {
+ let passedTests = 0;
+
+ function checkThatCookieDoesExpireAfter(cookieData, maxAgeInSeconds) {
+ let now = new Date();
+ let maxExpiryDateInMilliseconds = now.getTime() + (maxAgeInSeconds * 1000);
+
+ if (maxExpiryDateInMilliseconds < cookieData["expires"])
+ ++passedTests;
+ else
+ testFailed("Cookie named " + cookieData["name"] + " expires in less than " + maxAgeInSeconds + " seconds.");
+ }
+
+ const oneDayInSeconds = 24 * 60 * 60;
+ const twoDaysInSeconds = 2 * oneDayInSeconds;
+ const longLivedCookieMaxAge = { name : "longLivedCookieMaxAge", lifetime : "Max-Age=" + twoDaysInSeconds + ";" };
+ document.cookie = longLivedCookieMaxAge.name + "=foobar; " + longLivedCookieMaxAge.lifetime + " path=/";
+
+ const twoDaysAsExpiresDate = createExpiresDateFromMaxAge(twoDaysInSeconds);
+ const longLivedCookieExpires = { name : "longLivedCookieExpires", lifetime : "Expires=" + twoDaysAsExpiresDate + ";" };
+ document.cookie = longLivedCookieExpires.name + "=foobar; " + longLivedCookieExpires.lifetime + " path=/";
+
+ const overOneDayInSeconds = oneDayInSeconds + 30;
+ if (internals) {
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed("No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case longLivedCookieMaxAge.name:
+ checkThatCookieDoesExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ case longLivedCookieExpires.name:
+ checkThatCookieDoesExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ }
+ }
+
+ resetCookiesForCurrentOrigin();
+
+ if (passedTests === 2) {
+ testPassed("The two long-lived cookies expire after more than " + overOneDayInSeconds + " seconds.");
+ } else
+ testFailed("At least one cookie's expiry attribute was below the test thresholds.");
+ } else
+ testFailed("No internals object.");
+
+ setEnableFeature(false, finishJSTest);
+ }
+
+ function navigateCrossOrigin() {
+ document.location.href = prevalentResourceOrigin + "/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html?link=decoration#fragment";
+ }
+
+ const destinationOrigin = "http://localhost:8000";
+ const prevalentResourceOrigin = "http://127.0.0.1:8000";
+ function runTest() {
+ if (document.location.origin === prevalentResourceOrigin && document.location.hash !== "#fragment") {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsPrevalentResource(prevalentResourceOrigin, true, function() {
+ if (!testRunner.isStatisticsPrevalentResource(prevalentResourceOrigin))
+ testFailed("Host did not get set as prevalent resource.");
+ testRunner.statisticsUpdateCookieBlocking(navigateCrossOrigin);
+ });
+
+ });
+ } else {
+ testCookies();
+ }
+ }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkfragmentfromprevalentresourceexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Check that cookies created by JavaScript after a cross-site navigation with link fragment get capped to 24 hours.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS The two short-lived cookies don't expire after more than 43230 seconds.
+PASS The two long-lived cookies don't expire after more than 86430 seconds.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkfragmentfromprevalentresourcehtml"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/js-test-resources/js-test.js"></script>
+ <script src="/cookies/resources/cookie-utilities.js"></script>
+ <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout('runTest()', 0)">
+<script>
+ description("Check that cookies created by JavaScript after a cross-site navigation with link fragment get capped to 24 hours.");
+ jsTestIsAsync = true;
+
+ function testCookies() {
+ let passedTests = 0;
+ function checkThatCookieDoesNotExpireAfter(cookieData, maxAgeInSeconds) {
+ let now = new Date();
+ let maxExpiryDateInMilliseconds = now.getTime() + (maxAgeInSeconds * 1000);
+
+ if (maxExpiryDateInMilliseconds > cookieData["expires"])
+ ++passedTests;
+ else
+ testFailed("Cookie named " + cookieData["name"] + " expires in more than " + maxAgeInSeconds + " seconds.");
+ }
+
+ const twelveHoursInSeconds = 12 * 60 * 60;
+ const shortLivedCookieMaxAge = { name : "shortLivedCookieMaxAge", lifetime : "Max-Age=" + twelveHoursInSeconds + ";" };
+ document.cookie = shortLivedCookieMaxAge.name + "=foobar; " + shortLivedCookieMaxAge.lifetime + " path=/";
+
+ const twelveHoursAsExpiresDate = createExpiresDateFromMaxAge(twelveHoursInSeconds);
+ const shortLivedCookieExpires = { name : "shortLivedCookieExpires", lifetime : "Expires=" + twelveHoursAsExpiresDate + ";" };
+ document.cookie = shortLivedCookieExpires.name + "=foobar; " + shortLivedCookieExpires.lifetime + " path=/";
+
+ const oneDayInSeconds = 2 * twelveHoursInSeconds;
+ const twoDaysInSeconds = 2 * oneDayInSeconds;
+ const longLivedCookieMaxAge = { name : "longLivedCookieMaxAge", lifetime : "Max-Age=" + twoDaysInSeconds + ";" };
+ document.cookie = longLivedCookieMaxAge.name + "=foobar; " + longLivedCookieMaxAge.lifetime + " path=/";
+
+ const twoDaysAsExpiresDate = createExpiresDateFromMaxAge(twoDaysInSeconds);
+ const longLivedCookieExpires = { name : "longLivedCookieExpires", lifetime : "Expires=" + twoDaysAsExpiresDate + ";" };
+ document.cookie = longLivedCookieExpires.name + "=foobar; " + longLivedCookieExpires.lifetime + " path=/";
+
+ const overTwelveHoursInSeconds = twelveHoursInSeconds + 30;
+ const overOneDayInSeconds = oneDayInSeconds + 30;
+ if (internals) {
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed("No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case shortLivedCookieMaxAge.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overTwelveHoursInSeconds);
+ break;
+ case shortLivedCookieExpires.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overTwelveHoursInSeconds);
+ break;
+ case longLivedCookieMaxAge.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ case longLivedCookieExpires.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ }
+ }
+
+ resetCookiesForCurrentOrigin();
+
+ if (passedTests === 4) {
+ testPassed("The two short-lived cookies don't expire after more than " + overTwelveHoursInSeconds + " seconds.");
+ testPassed("The two long-lived cookies don't expire after more than " + overOneDayInSeconds + " seconds.");
+ } else
+ testFailed("At least one cookie's expiry attribute was beyond the test thresholds.");
+ } else
+ testFailed("No internals object.");
+
+ setEnableFeature(false, finishJSTest);
+ }
+
+ function navigateCrossOrigin() {
+ document.location.href = destinationOrigin + "/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html#link=fragment";
+ }
+
+ const destinationOrigin = "http://localhost:8000";
+ const prevalentResourceOrigin = "http://127.0.0.1:8000";
+ function runTest() {
+ if (document.location.origin === prevalentResourceOrigin) {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsPrevalentResource(prevalentResourceOrigin, true, function() {
+ if (!testRunner.isStatisticsPrevalentResource(prevalentResourceOrigin))
+ testFailed("Host did not get set as prevalent resource.");
+ testRunner.statisticsUpdateCookieBlocking(navigateCrossOrigin);
+ });
+
+ });
+ } else {
+ testCookies();
+ }
+ }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryandfragmentfromprevalentresourceexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Check that cookies created by JavaScript after a cross-site navigation with link query and fragment get capped to 24 hours.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS The two short-lived cookies don't expire after more than 43230 seconds.
+PASS The two long-lived cookies don't expire after more than 86430 seconds.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryandfragmentfromprevalentresourcehtml"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/js-test-resources/js-test.js"></script>
+ <script src="/cookies/resources/cookie-utilities.js"></script>
+ <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout('runTest()', 0)">
+<script>
+ description("Check that cookies created by JavaScript after a cross-site navigation with link query and fragment get capped to 24 hours.");
+ jsTestIsAsync = true;
+
+ function testCookies() {
+ let passedTests = 0;
+ function checkThatCookieDoesNotExpireAfter(cookieData, maxAgeInSeconds) {
+ let now = new Date();
+ let maxExpiryDateInMilliseconds = now.getTime() + (maxAgeInSeconds * 1000);
+
+ if (maxExpiryDateInMilliseconds > cookieData["expires"])
+ ++passedTests;
+ else
+ testFailed("Cookie named " + cookieData["name"] + " expires in more than " + maxAgeInSeconds + " seconds.");
+ }
+
+ const twelveHoursInSeconds = 12 * 60 * 60;
+ const shortLivedCookieMaxAge = { name : "shortLivedCookieMaxAge", lifetime : "Max-Age=" + twelveHoursInSeconds + ";" };
+ document.cookie = shortLivedCookieMaxAge.name + "=foobar; " + shortLivedCookieMaxAge.lifetime + " path=/";
+
+ const twelveHoursAsExpiresDate = createExpiresDateFromMaxAge(twelveHoursInSeconds);
+ const shortLivedCookieExpires = { name : "shortLivedCookieExpires", lifetime : "Expires=" + twelveHoursAsExpiresDate + ";" };
+ document.cookie = shortLivedCookieExpires.name + "=foobar; " + shortLivedCookieExpires.lifetime + " path=/";
+
+ const oneDayInSeconds = 2 * twelveHoursInSeconds;
+ const twoDaysInSeconds = 2 * oneDayInSeconds;
+ const longLivedCookieMaxAge = { name : "longLivedCookieMaxAge", lifetime : "Max-Age=" + twoDaysInSeconds + ";" };
+ document.cookie = longLivedCookieMaxAge.name + "=foobar; " + longLivedCookieMaxAge.lifetime + " path=/";
+
+ const twoDaysAsExpiresDate = createExpiresDateFromMaxAge(twoDaysInSeconds);
+ const longLivedCookieExpires = { name : "longLivedCookieExpires", lifetime : "Expires=" + twoDaysAsExpiresDate + ";" };
+ document.cookie = longLivedCookieExpires.name + "=foobar; " + longLivedCookieExpires.lifetime + " path=/";
+
+ const overTwelveHoursInSeconds = twelveHoursInSeconds + 30;
+ const overOneDayInSeconds = oneDayInSeconds + 30;
+ if (internals) {
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed("No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case shortLivedCookieMaxAge.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overTwelveHoursInSeconds);
+ break;
+ case shortLivedCookieExpires.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overTwelveHoursInSeconds);
+ break;
+ case longLivedCookieMaxAge.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ case longLivedCookieExpires.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ }
+ }
+
+ resetCookiesForCurrentOrigin();
+
+ if (passedTests === 4) {
+ testPassed("The two short-lived cookies don't expire after more than " + overTwelveHoursInSeconds + " seconds.");
+ testPassed("The two long-lived cookies don't expire after more than " + overOneDayInSeconds + " seconds.");
+ } else
+ testFailed("At least one cookie's expiry attribute was beyond the test thresholds.");
+ } else
+ testFailed("No internals object.");
+
+ setEnableFeature(false, finishJSTest);
+ }
+
+ function navigateCrossOrigin() {
+ document.location.href = destinationOrigin + "/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html?link=query#link=fragment";
+ }
+
+ const destinationOrigin = "http://localhost:8000";
+ const prevalentResourceOrigin = "http://127.0.0.1:8000";
+ function runTest() {
+ if (document.location.origin === prevalentResourceOrigin) {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsPrevalentResource(prevalentResourceOrigin, true, function() {
+ if (!testRunner.isStatisticsPrevalentResource(prevalentResourceOrigin))
+ testFailed("Host did not get set as prevalent resource.");
+ testRunner.statisticsUpdateCookieBlocking(navigateCrossOrigin);
+ });
+
+ });
+ } else {
+ testCookies();
+ }
+ }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryfromprevalentresourceexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Check that cookies created by JavaScript after a cross-site navigation with link query get capped to 24 hours.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS The two short-lived cookies don't expire after more than 43230 seconds.
+PASS The two long-lived cookies don't expire after more than 86430 seconds.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithlinkqueryfromprevalentresourcehtml"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/js-test-resources/js-test.js"></script>
+ <script src="/cookies/resources/cookie-utilities.js"></script>
+ <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout('runTest()', 0)">
+<script>
+ description("Check that cookies created by JavaScript after a cross-site navigation with link query get capped to 24 hours.");
+ jsTestIsAsync = true;
+
+ function testCookies() {
+ let passedTests = 0;
+ function checkThatCookieDoesNotExpireAfter(cookieData, maxAgeInSeconds) {
+ let now = new Date();
+ let maxExpiryDateInMilliseconds = now.getTime() + (maxAgeInSeconds * 1000);
+
+ if (maxExpiryDateInMilliseconds > cookieData["expires"])
+ ++passedTests;
+ else
+ testFailed("Cookie named " + cookieData["name"] + " expires in more than " + maxAgeInSeconds + " seconds.");
+ }
+
+ const twelveHoursInSeconds = 12 * 60 * 60;
+ const shortLivedCookieMaxAge = { name : "shortLivedCookieMaxAge", lifetime : "Max-Age=" + twelveHoursInSeconds + ";" };
+ document.cookie = shortLivedCookieMaxAge.name + "=foobar; " + shortLivedCookieMaxAge.lifetime + " path=/";
+
+ const twelveHoursAsExpiresDate = createExpiresDateFromMaxAge(twelveHoursInSeconds);
+ const shortLivedCookieExpires = { name : "shortLivedCookieExpires", lifetime : "Expires=" + twelveHoursAsExpiresDate + ";" };
+ document.cookie = shortLivedCookieExpires.name + "=foobar; " + shortLivedCookieExpires.lifetime + " path=/";
+
+ const oneDayInSeconds = 2 * twelveHoursInSeconds;
+ const twoDaysInSeconds = 2 * oneDayInSeconds;
+ const longLivedCookieMaxAge = { name : "longLivedCookieMaxAge", lifetime : "Max-Age=" + twoDaysInSeconds + ";" };
+ document.cookie = longLivedCookieMaxAge.name + "=foobar; " + longLivedCookieMaxAge.lifetime + " path=/";
+
+ const twoDaysAsExpiresDate = createExpiresDateFromMaxAge(twoDaysInSeconds);
+ const longLivedCookieExpires = { name : "longLivedCookieExpires", lifetime : "Expires=" + twoDaysAsExpiresDate + ";" };
+ document.cookie = longLivedCookieExpires.name + "=foobar; " + longLivedCookieExpires.lifetime + " path=/";
+
+ const overTwelveHoursInSeconds = twelveHoursInSeconds + 30;
+ const overOneDayInSeconds = oneDayInSeconds + 30;
+ if (internals) {
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed("No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case shortLivedCookieMaxAge.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overTwelveHoursInSeconds);
+ break;
+ case shortLivedCookieExpires.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overTwelveHoursInSeconds);
+ break;
+ case longLivedCookieMaxAge.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ case longLivedCookieExpires.name:
+ checkThatCookieDoesNotExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ }
+ }
+
+ resetCookiesForCurrentOrigin();
+
+ if (passedTests === 4) {
+ testPassed("The two short-lived cookies don't expire after more than " + overTwelveHoursInSeconds + " seconds.");
+ testPassed("The two long-lived cookies don't expire after more than " + overOneDayInSeconds + " seconds.");
+ } else
+ testFailed("At least one cookie's expiry attribute was beyond the test thresholds.");
+ } else
+ testFailed("No internals object.");
+
+ setEnableFeature(false, finishJSTest);
+ }
+
+ function navigateCrossOrigin() {
+ document.location.href = destinationOrigin + "/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html?link=query";
+ }
+
+ const destinationOrigin = "http://localhost:8000";
+ const prevalentResourceOrigin = "http://127.0.0.1:8000";
+ function runTest() {
+ if (document.location.origin === prevalentResourceOrigin) {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsPrevalentResource(prevalentResourceOrigin, true, function() {
+ if (!testRunner.isStatisticsPrevalentResource(prevalentResourceOrigin))
+ testFailed("Host did not get set as prevalent resource.");
+ testRunner.statisticsUpdateCookieBlocking(navigateCrossOrigin);
+ });
+
+ });
+ } else {
+ testCookies();
+ }
+ }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithoutlinkdecorationfromprevalentresourceexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Check that cookies created by JavaScript after a cross-site navigation without link decoration don't get capped to 24 hours.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS The two long-lived cookies expire after more than 86430 seconds.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjswithoutlinkdecorationfromprevalentresourcehtml"></a>
<div class="addfile"><h4>Added: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html (0 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html (rev 0)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/js-test-resources/js-test.js"></script>
+ <script src="/cookies/resources/cookie-utilities.js"></script>
+ <script src="resources/util.js"></script>
+</head>
+<body onload="setTimeout('runTest()', 0)">
+<script>
+ description("Check that cookies created by JavaScript after a cross-site navigation without link decoration don't get capped to 24 hours.");
+ jsTestIsAsync = true;
+
+ function testCookies() {
+ let passedTests = 0;
+
+ function checkThatCookieDoesExpireAfter(cookieData, maxAgeInSeconds) {
+ let now = new Date();
+ let maxExpiryDateInMilliseconds = now.getTime() + (maxAgeInSeconds * 1000);
+
+ if (maxExpiryDateInMilliseconds < cookieData["expires"])
+ ++passedTests;
+ else
+ testFailed("Cookie named " + cookieData["name"] + " expires in less than " + maxAgeInSeconds + " seconds.");
+ }
+
+ const oneDayInSeconds = 24 * 60 * 60;
+ const twoDaysInSeconds = 2 * oneDayInSeconds;
+ const longLivedCookieMaxAge = { name : "longLivedCookieMaxAge", lifetime : "Max-Age=" + twoDaysInSeconds + ";" };
+ document.cookie = longLivedCookieMaxAge.name + "=foobar; " + longLivedCookieMaxAge.lifetime + " path=/";
+
+ const twoDaysAsExpiresDate = createExpiresDateFromMaxAge(twoDaysInSeconds);
+ const longLivedCookieExpires = { name : "longLivedCookieExpires", lifetime : "Expires=" + twoDaysAsExpiresDate + ";" };
+ document.cookie = longLivedCookieExpires.name + "=foobar; " + longLivedCookieExpires.lifetime + " path=/";
+
+ const overOneDayInSeconds = oneDayInSeconds + 30;
+ if (internals) {
+ let cookies = internals.getCookies();
+ if (!cookies.length)
+ testFailed("No cookies found.");
+ for (let cookie of cookies) {
+ switch (cookie.name) {
+ case longLivedCookieMaxAge.name:
+ checkThatCookieDoesExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ case longLivedCookieExpires.name:
+ checkThatCookieDoesExpireAfter(cookie, overOneDayInSeconds);
+ break;
+ }
+ }
+
+ resetCookiesForCurrentOrigin();
+
+ if (passedTests === 2) {
+ testPassed("The two long-lived cookies expire after more than " + overOneDayInSeconds + " seconds.");
+ } else
+ testFailed("At least one cookie's expiry attribute was below the test thresholds.");
+ } else
+ testFailed("No internals object.");
+
+ setEnableFeature(false, finishJSTest);
+ }
+
+ function navigateCrossOrigin() {
+ document.location.href = destinationOrigin + "/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html";
+ }
+
+ const destinationOrigin = "http://localhost:8000";
+ const prevalentResourceOrigin = "http://127.0.0.1:8000";
+ function runTest() {
+ if (document.location.origin === prevalentResourceOrigin) {
+ setEnableFeature(true, function () {
+ testRunner.setStatisticsPrevalentResource(prevalentResourceOrigin, true, function() {
+ if (!testRunner.isStatisticsPrevalentResource(prevalentResourceOrigin))
+ testFailed("Host did not get set as prevalent resource.");
+ testRunner.statisticsUpdateCookieBlocking(navigateCrossOrigin);
+ });
+
+ });
+ } else {
+ testCookies();
+ }
+ }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari607branchLayoutTestshttptestsresourceLoadStatisticscappedlifetimeforcookiesetinjshtml"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -62,6 +62,9 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+ resetCookiesForCurrentOrigin();
+
</ins><span class="cx"> if (passedTests === 4) {
</span><span class="cx"> testPassed("The two short-lived cookies don't expire after more than " + overTwoDaysInSeconds + " seconds.");
</span><span class="cx"> testPassed("The two long-lived cookies don't expire after more than " + overOneWeekInSeconds + " seconds.");
</span></span></pre></div>
<a id="branchessafari607branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebCore/ChangeLog 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2019-03-18 Kocsen Chung <kocsen_chung@apple.com>
+
+ Apply patch. rdar://problem/48839387
+
+ 2019-03-18 John Wilander <wilander@apple.com>
+
+ Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration (branch patch)
+ https://bugs.webkit.org/show_bug.cgi?id=195711
+ <rdar://problem/48839387>
+ <rdar://problem/48832278>
+
+ Reviewed by Brent Fulgham.
+
+ Tests: http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html
+ http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html
+ http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html
+ http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html
+ http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html
+
+ This patch does three things:
+
+ 1) Applies the changes in https://trac.webkit.org/changeset/242288 to
+ a branch. The only meaningful difference is the use of String instead
+ of WebCore::RegistrableDomain. Tracked by <rdar://problem/48839387>.
+
+ 2) Set the lifetime cap for client-side cookies in the call to
+ NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor(). This
+ change makes sure that if ITP is enabled, the cap will be applied.
+ Previously, the cap was set when WebProcessPool::ensureNetworkProcess()
+ called WebsiteDataStore::didCreateNetworkProcess() which might fail if
+ the website data store's m_resourceLoadStatistics object is not created
+ yet. Tracked by <rdar://problem/48832278>.
+
+ 3) Makes sure WebProcessPool::ensureNetworkProcess() calls
+ WebsiteDataStore::didCreateNetworkProcess() also if there was an
+ existing website data store object supplied (the withWebsiteDataStore
+ parameter). Tracked by <rdar://problem/48832278>.
+
+ * platform/network/NetworkStorageSession.cpp:
+ (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
+ (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
+ (WebCore::NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics):
+ (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration):
+ (WebCore::NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting):
+ (WebCore::NetworkStorageSession::clientSideCookieCap const):
+ (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
+ * platform/network/NetworkStorageSession.h:
+ * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+ (WebCore::filterCookies):
+ (WebCore::NetworkStorageSession::setCookiesFromDOM const):
+
</ins><span class="cx"> 2019-03-13 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Cherry-pick r242749. rdar://problem/48839358
</span></span></pre></div>
<a id="branchessafari607branchSourceWebCoreplatformnetworkNetworkStorageSessioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -137,6 +137,7 @@
</span><span class="cx"> void NetworkStorageSession::setAgeCapForClientSideCookies(Optional<Seconds> seconds)
</span><span class="cx"> {
</span><span class="cx"> m_ageCapForClientSideCookies = seconds;
</span><ins>+ m_ageCapForClientSideCookiesShort = seconds ? Seconds { seconds->seconds() / 7. } : seconds;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor(const Vector<String>& domains)
</span><span class="lines">@@ -143,6 +144,12 @@
</span><span class="cx"> {
</span><span class="cx"> m_topPrivatelyControlledDomainsToBlock.clear();
</span><span class="cx"> m_topPrivatelyControlledDomainsToBlock.add(domains.begin(), domains.end());
</span><ins>+
+ static NeverDestroyed<Seconds> oneWeekInSeconds = 24_h * 7;
+ if (!m_ageCapForClientSideCookies)
+ setAgeCapForClientSideCookies({ oneWeekInSeconds });
+ if (!m_cacheMaxAgeCapForPrevalentResources)
+ setCacheMaxAgeCapForPrevalentResources(oneWeekInSeconds);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void NetworkStorageSession::removePrevalentDomains(const Vector<String>& domains)
</span><span class="lines">@@ -227,10 +234,12 @@
</span><span class="cx"> iteration->value.remove(frameID);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void NetworkStorageSession::removeStorageAccessForAllFramesOnPage(uint64_t pageID)
</del><ins>+void NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics(uint64_t pageID)
</ins><span class="cx"> {
</span><span class="cx"> m_pagesGrantedStorageAccess.remove(pageID);
</span><span class="cx"> m_framesGrantedStorageAccess.remove(pageID);
</span><ins>+ if (!m_navigationWithLinkDecorationTestMode)
+ m_navigatedToWithLinkDecorationByPrevalentResource.remove(pageID);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void NetworkStorageSession::removeAllStorageAccess()
</span><span class="lines">@@ -248,6 +257,38 @@
</span><span class="cx"> {
</span><span class="cx"> m_cacheMaxAgeCapForPrevalentResources = WTF::nullopt;
</span><span class="cx"> }
</span><ins>+
+void NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration(const String& fromRegistrableDomain, const String& toRegistrableDomain, uint64_t pageID)
+{
+ if (shouldBlockThirdPartyCookies(fromRegistrableDomain))
+ m_navigatedToWithLinkDecorationByPrevalentResource.add(pageID, toRegistrableDomain);
+}
+
+void NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting()
+{
+ m_navigatedToWithLinkDecorationByPrevalentResource.clear();
+ m_navigationWithLinkDecorationTestMode = true;
+}
+
+Optional<Seconds> NetworkStorageSession::clientSideCookieCap(const URL& url, Optional<uint64_t> pageID) const
+{
+ if (!m_ageCapForClientSideCookies || !pageID || m_navigatedToWithLinkDecorationByPrevalentResource.isEmpty())
+ return m_ageCapForClientSideCookies;
+
+ auto domainIterator = m_navigatedToWithLinkDecorationByPrevalentResource.find(*pageID);
+ if (domainIterator == m_navigatedToWithLinkDecorationByPrevalentResource.end())
+ return m_ageCapForClientSideCookies;
+
+ auto domain = url.host().toString();
+#if ENABLE(PUBLIC_SUFFIX_LIST)
+ domain = topPrivatelyControlledDomain(domain);
+#endif
+
+ if (domainIterator->value == domain)
+ return m_ageCapForClientSideCookiesShort;
+
+ return m_ageCapForClientSideCookies;
+}
</ins><span class="cx"> #endif // ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari607branchSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.h (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.h 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebCore/platform/network/NetworkStorageSession.h 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -158,11 +158,13 @@
</span><span class="cx"> WEBCORE_EXPORT Vector<String> getAllStorageAccessEntries() const;
</span><span class="cx"> WEBCORE_EXPORT void grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID);
</span><span class="cx"> WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID);
</span><del>- WEBCORE_EXPORT void removeStorageAccessForAllFramesOnPage(uint64_t pageID);
</del><ins>+ WEBCORE_EXPORT void clearPageSpecificDataForResourceLoadStatistics(uint64_t pageID);
</ins><span class="cx"> WEBCORE_EXPORT void removeAllStorageAccess();
</span><span class="cx"> WEBCORE_EXPORT void setCacheMaxAgeCapForPrevalentResources(Seconds);
</span><span class="cx"> WEBCORE_EXPORT void resetCacheMaxAgeCapForPrevalentResources();
</span><span class="cx"> WEBCORE_EXPORT Optional<Seconds> maxAgeCacheCap(const ResourceRequest&);
</span><ins>+ WEBCORE_EXPORT void committedCrossSiteLoadWithLinkDecoration(const String& fromRegistrableDomain, const String& toRegistrableDomain, uint64_t pageID);
+ WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="lines">@@ -191,11 +193,15 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx"> bool shouldBlockThirdPartyCookies(const String& topPrivatelyControlledDomain) const;
</span><ins>+ Optional<Seconds> clientSideCookieCap(const URL&, Optional<uint64_t> pageID) const;
</ins><span class="cx"> HashSet<String> m_topPrivatelyControlledDomainsToBlock;
</span><span class="cx"> HashMap<uint64_t, HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess;
</span><span class="cx"> HashMap<uint64_t, HashMap<String, String>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_pagesGrantedStorageAccess;
</span><span class="cx"> Optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { };
</span><span class="cx"> Optional<Seconds> m_ageCapForClientSideCookies { };
</span><ins>+ Optional<Seconds> m_ageCapForClientSideCookiesShort { };
+ HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_navigatedToWithLinkDecorationByPrevalentResource;
+ bool m_navigationWithLinkDecorationTestMode = false;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span></span></pre></div>
<a id="branchessafari607branchSourceWebCoreplatformnetworkcocoaNetworkStorageSessionCocoamm"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -404,7 +404,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span><del>- RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, m_ageCapForClientSideCookies);
</del><ins>+ RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, clientSideCookieCap(firstParty, pageID));
</ins><span class="cx"> #else
</span><span class="cx"> RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, false);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/ChangeLog 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -1,3 +1,98 @@
</span><ins>+2019-03-18 Kocsen Chung <kocsen_chung@apple.com>
+
+ Apply patch. rdar://problem/48839387
+
+ 2019-03-18 John Wilander <wilander@apple.com>
+
+ Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration (branch patch)
+ https://bugs.webkit.org/show_bug.cgi?id=195711
+ <rdar://problem/48839387>
+ <rdar://problem/48832278>
+
+ Reviewed by Brent Fulgham.
+
+ This patch does three things:
+
+ 1) Applies the changes in https://trac.webkit.org/changeset/242288 to
+ a branch. The only meaningful difference is the use of String instead
+ of WebCore::RegistrableDomain. Tracked by <rdar://problem/48839387>.
+
+ 2) Set the lifetime cap for client-side cookies in the call to
+ NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor(). This
+ change makes sure that if ITP is enabled, the cap will be applied.
+ Previously, the cap was set when WebProcessPool::ensureNetworkProcess()
+ called WebsiteDataStore::didCreateNetworkProcess() which might fail if
+ the website data store's m_resourceLoadStatistics object is not created
+ yet. Tracked by <rdar://problem/48832278>.
+
+ 3) Makes sure WebProcessPool::ensureNetworkProcess() calls
+ WebsiteDataStore::didCreateNetworkProcess() also if there was an
+ existing website data store object supplied (the withWebsiteDataStore
+ parameter). Tracked by <rdar://problem/48832278>.
+
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
+ (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): Deleted.
+ * NetworkProcess/NetworkConnectionToWebProcess.h:
+ * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
+ (WebKit::NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+ (WKWebsiteDataStoreStatisticsResetToConsistentState):
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting):
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+ (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::isNonUniqueNavigationWithLinkDecoration):
+ (WebKit::WebPageProxy::didCommitLoadForFrame):
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::ensureNetworkProcess):
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::close):
+
+2019-03-06 Kocsen Chung <kocsen_chung@apple.com>
+
+ Cherry-pick r242554. rdar://problem/48647490
+
+ REGRESSION (r238490): YouTube.com: Returning PiP to Safari after sleeping device loses page
+ https://bugs.webkit.org/show_bug.cgi?id=195364
+ <rdar://problem/48538837>
+
+ Reviewed by Geoffrey Garen.
+
+ Make sure we unset the LayerTreeFreezeReason::ProcessSuspended layer tree freeze reason
+ when WebPage::applicationWillEnterForeground() is called. This restores pre-r238490
+ behavior and addresses the issue with PiP on youtube.com.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::applicationWillEnterForeground):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-03-06 Chris Dumez <cdumez@apple.com>
+
+ REGRESSION (r238490): YouTube.com: Returning PiP to Safari after sleeping device loses page
+ https://bugs.webkit.org/show_bug.cgi?id=195364
+ <rdar://problem/48538837>
+
+ Reviewed by Geoffrey Garen.
+
+ Make sure we unset the LayerTreeFreezeReason::ProcessSuspended layer tree freeze reason
+ when WebPage::applicationWillEnterForeground() is called. This restores pre-r238490
+ behavior and addresses the issue with PiP on youtube.com.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::applicationWillEnterForeground):
+
</ins><span class="cx"> 2019-03-13 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Apply patch. rdar://problem/48839383
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitNetworkProcessNetworkConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -567,11 +567,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID)
</del><ins>+void NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics(PAL::SessionID sessionID, uint64_t pageID)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx"> if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
</span><del>- storageSession->removeStorageAccessForAllFramesOnPage(pageID);
</del><ins>+ storageSession->clearPageSpecificDataForResourceLoadStatistics(pageID);
</ins><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(sessionID);
</span><span class="cx"> UNUSED_PARAM(pageID);
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitNetworkProcessNetworkConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -191,7 +191,7 @@
</span><span class="cx"> CacheStorageEngineConnection& cacheStorageConnection();
</span><span class="cx">
</span><span class="cx"> void removeStorageAccessForFrame(PAL::SessionID, uint64_t frameID, uint64_t pageID);
</span><del>- void removeStorageAccessForAllFramesOnPage(PAL::SessionID, uint64_t pageID);
</del><ins>+ void clearPageSpecificDataForResourceLoadStatistics(PAL::SessionID, uint64_t pageID);
</ins><span class="cx">
</span><span class="cx"> void addOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains);
</span><span class="cx"> void removeOriginAccessWhitelistEntry(const String& sourceOrigin, const String& destinationProtocol, const String& destinationHost, bool allowDestinationSubdomains);
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitNetworkProcessNetworkConnectionToWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> EnsureLegacyPrivateBrowsingSession()
</span><span class="cx">
</span><span class="cx"> RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
</span><del>- RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID);
</del><ins>+ ClearPageSpecificDataForResourceLoadStatistics(PAL::SessionID sessionID, uint64_t pageID);
</ins><span class="cx">
</span><span class="cx"> AddOriginAccessWhitelistEntry(String sourceOrigin, String destinationProtocol, String destinationHost, bool allowDestinationSubdomains);
</span><span class="cx"> RemoveOriginAccessWhitelistEntry(String sourceOrigin, String destinationProtocol, String destinationHost, bool allowDestinationSubdomains);
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitNetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -555,6 +555,23 @@
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> parentProcessConnection()->send(Messages::NetworkProcessProxy::DidResetCacheMaxAgeCapForPrevalentResources(contextId), 0);
</span><span class="cx"> }
</span><ins>+
+void NetworkProcess::committedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, const String& fromRegistrableDomain, const String& toRegistrableDomain, uint64_t pageID)
+{
+ if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
+ networkStorageSession->committedCrossSiteLoadWithLinkDecoration(fromRegistrableDomain, toRegistrableDomain, pageID);
+ else
+ ASSERT_NOT_REACHED();
+}
+
+void NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
+{
+ if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
+ networkStorageSession->resetCrossSiteLoadsWithLinkDecorationForTesting();
+ else
+ ASSERT_NOT_REACHED();
+ completionHandler();
+}
</ins><span class="cx"> #endif // ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">
</span><span class="cx"> bool NetworkProcess::sessionIsControlledByAutomation(PAL::SessionID sessionID) const
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitNetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.h (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -162,6 +162,8 @@
</span><span class="cx"> void removePrevalentDomains(PAL::SessionID, const Vector<String>& domains);
</span><span class="cx"> void setCacheMaxAgeCapForPrevalentResources(PAL::SessionID, Seconds, uint64_t contextId);
</span><span class="cx"> void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, uint64_t contextId);
</span><ins>+ void committedCrossSiteLoadWithLinkDecoration(PAL::SessionID, const String& fromRegistrableDomain, const String& toRegistrableDomain, uint64_t pageID);
+ void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> using CacheStorageParametersCallback = CompletionHandler<void(const String&, uint64_t quota)>;
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitNetworkProcessNetworkProcessmessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -94,6 +94,8 @@
</span><span class="cx"> RemovePrevalentDomains(PAL::SessionID sessionID, Vector<String> domainsWithInteraction)
</span><span class="cx"> SetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID, Seconds seconds, uint64_t contextId)
</span><span class="cx"> ResetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID, uint64_t contextId)
</span><ins>+ CommittedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, String fromRegistrableDomain, String toRegistrableDomain, uint64_t pageID)
+ ResetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID) -> () Async
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> SetSessionIsControlledByAutomation(PAL::SessionID sessionID, bool controlled);
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessAPICWKWebsiteDataStoreRefcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -482,6 +482,7 @@
</span><span class="cx"> auto& store = WebKit::toImpl(dataStoreRef)->websiteDataStore();
</span><span class="cx"> store.clearResourceLoadStatisticsInWebProcesses([callbackAggregator = callbackAggregator.copyRef()] { });
</span><span class="cx"> store.resetCacheMaxAgeCapForPrevalentResources([callbackAggregator = callbackAggregator.copyRef()] { });
</span><ins>+ store.resetCrossSiteLoadsWithLinkDecorationForTesting([callbackAggregator = callbackAggregator.copyRef()] { });
</ins><span class="cx">
</span><span class="cx"> auto* statisticsStore = store.resourceLoadStatistics();
</span><span class="cx"> if (!statisticsStore)
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -531,6 +531,16 @@
</span><span class="cx"> auto completionHandler = m_updateRuntimeSettingsCallbackMap.take(contextId);
</span><span class="cx"> completionHandler();
</span><span class="cx"> }
</span><ins>+
+void NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
+{
+ if (!canSendMessage()) {
+ completionHandler();
+ return;
+ }
+
+ sendWithAsyncReply(Messages::NetworkProcess::ResetCrossSiteLoadsWithLinkDecorationForTesting(sessionID), WTFMove(completionHandler));
+}
</ins><span class="cx"> #endif // ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">
</span><span class="cx"> void NetworkProcessProxy::sendProcessWillSuspendImminently()
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx"> void removeAllStorageAccess(PAL::SessionID, CompletionHandler<void()>&&);
</span><span class="cx"> void setCacheMaxAgeCapForPrevalentResources(PAL::SessionID, Seconds, CompletionHandler<void()>&&);
</span><span class="cx"> void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&);
</span><ins>+ void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> void writeBlobToFilePath(const URL&, const String& path, CompletionHandler<void(bool)>&&);
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessResourceLoadStatisticsMemoryStorecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -1290,8 +1290,6 @@
</span><span class="cx"> ASSERT(!RunLoop::isMain());
</span><span class="cx">
</span><span class="cx"> updateCookieBlocking([]() { });
</span><del>- updateCacheMaxAgeCap();
- updateClientSideCookiesAgeCap();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -4027,6 +4027,13 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+static bool isNonUniqueNavigationWithLinkDecoration(const SecurityOriginData requesterOrigin, const URL& currentURL)
+{
+ return !requesterOrigin.securityOrigin()->isUnique() && (!currentURL.query().isEmpty() || !currentURL.fragmentIdentifier().isEmpty());
+}
+#endif
+
</ins><span class="cx"> void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, Optional<HasInsecureContent> hasInsecureContent, const UserData& userData)
</span><span class="cx"> {
</span><span class="cx"> LOG(Loading, "(Loading) WebPageProxy %" PRIu64 " didCommitLoadForFrame in navigation %" PRIu64, m_pageID, m_navigationID);
</span><span class="lines">@@ -4040,8 +4047,19 @@
</span><span class="cx">
</span><span class="cx"> // FIXME: We should message check that navigationID is not zero here, but it's currently zero for some navigations through the page cache.
</span><span class="cx"> RefPtr<API::Navigation> navigation;
</span><del>- if (frame->isMainFrame() && navigationID)
</del><ins>+ if (frame->isMainFrame() && navigationID) {
</ins><span class="cx"> navigation = navigationState().navigation(navigationID);
</span><ins>+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+ auto requesterOrigin = navigation->lastNavigationAction().requesterOrigin;
+ auto currentURL = navigation->currentRequest().url();
+ if (isNonUniqueNavigationWithLinkDecoration(requesterOrigin, currentURL)) {
+ String fromRegistrableDomain = WebCore::topPrivatelyControlledDomain(requesterOrigin.host);
+ String toRegistrableDomain = WebCore::topPrivatelyControlledDomain(currentURL.host().toString());
+ if (fromRegistrableDomain != toRegistrableDomain)
+ m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::CommittedCrossSiteLoadWithLinkDecoration(m_websiteDataStore->sessionID(), fromRegistrableDomain, toRegistrableDomain, m_pageID));
+ }
+ #endif
+ }
</ins><span class="cx">
</span><span class="cx"> m_hasCommittedAnyProvisionalLoads = true;
</span><span class="cx"> m_process->didCommitProvisionalLoad();
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessPool.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -596,6 +596,8 @@
</span><span class="cx">
</span><span class="cx"> if (m_websiteDataStore)
</span><span class="cx"> m_websiteDataStore->websiteDataStore().didCreateNetworkProcess();
</span><ins>+ else if (withWebsiteDataStore)
+ withWebsiteDataStore->didCreateNetworkProcess();
</ins><span class="cx">
</span><span class="cx"> return *m_networkProcess;
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -1371,6 +1371,16 @@
</span><span class="cx">
</span><span class="cx"> m_resourceLoadStatistics->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler));
</span><span class="cx"> }
</span><ins>+
+void WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&& completionHandler)
+{
+ auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
+
+ for (auto& processPool : processPools()) {
+ if (auto* networkProcess = processPool->networkProcess())
+ networkProcess->resetCrossSiteLoadsWithLinkDecorationForTesting(m_sessionID, [callbackAggregator = callbackAggregator.copyRef()] { });
+ }
+}
</ins><span class="cx"> #endif // ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">
</span><span class="cx"> void WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources(Seconds seconds, CompletionHandler<void()>&& completionHandler)
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitUIProcessWebsiteDataWebsiteDataStoreh"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -126,6 +126,7 @@
</span><span class="cx"> void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
</span><span class="cx"> void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
</span><span class="cx"> void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);
</span><ins>+ void resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&&);
</ins><span class="cx"> #endif
</span><span class="cx"> void setCacheMaxAgeCapForPrevalentResources(Seconds, CompletionHandler<void()>&&);
</span><span class="cx"> void resetCacheMaxAgeCapForPrevalentResources(CompletionHandler<void()>&&);
</span></span></pre></div>
<a id="branchessafari607branchSourceWebKitWebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (243096 => 243097)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-18 20:29:03 UTC (rev 243096)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-18 20:56:41 UTC (rev 243097)
</span><span class="lines">@@ -1208,7 +1208,7 @@
</span><span class="cx"> if (m_isClosed)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForAllFramesOnPage(sessionID(), m_pageID), 0);
</del><ins>+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::ClearPageSpecificDataForResourceLoadStatistics(sessionID(), m_pageID), 0);
</ins><span class="cx">
</span><span class="cx"> m_isClosed = true;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>