<!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>[213623] trunk</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/213623">213623</a></dd>
<dt>Author</dt> <dd>wilander@apple.com</dd>
<dt>Date</dt> <dd>2017-03-08 20:02:14 -0800 (Wed, 08 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Resource Load Statistics: Communicate to the network process which domains to partition
https://bugs.webkit.org/show_bug.cgi?id=169322
&lt;rdar://problem/30768921&gt;

Reviewed by Alex Christensen.

Source/WebCore:

Test: http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
    Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
    to tell the network process the domain has got user interaction.
(WebCore::ResourceLoadObserver::logUserInteraction):
    Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
    to tell the network process the domain has got user interaction.
(WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
    To allow TestRunner to set a domain for which
    partitioning should be applied.
(WebCore::ResourceLoadObserver::primaryDomain):
    New overloaded convenience function.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
    Now bootstraps the network process' set of known domains to
    partition cookies for.
(WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
(WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
(WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
    Now tells the network process to start partitioning again
    when user interaction ages out.
* loader/ResourceLoadStatisticsStore.h:
* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::shouldPartitionCookiesForHost):
(WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):

Source/WebKit2:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
    Now consults WebCore::NetworkStorageSession::shouldPartitionCookiesForHost()
    to decide whether partitioning should be applied or not.
* UIProcess/API/C/WKCookieManager.cpp:
(WKCookieManagerSetCookieStoragePartitioningEnabled):
    To allow TestRunner to configure cookie partitioning.
* UIProcess/API/C/WKCookieManager.h:
* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
    To allow TestRunner to set a domain for which
    partitioning should be applied.
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled):
    To allow TestRunner to configure cookie partitioning.
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
    To allow TestRunner to set a domain for which
    partitioning should be applied.
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::classifyResource):
    Now tells the network process as soon as a domain
    has been classified as prevalent.
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
    Overloaded function to allow injection of handlers for communication with the
    network process.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
(WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
    Now sets two callback handlers for communication with the network process.
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

These changes add support for two new TestRunner functions:
- setCookieStoragePartitioningEnabled()
- statisticsFireShouldPartitionCookiesHandler()

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setCookieStoragePartitioningEnabled):
(WTR::TestRunner::statisticsFireShouldPartitionCookiesHandler):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::statisticsFireShouldPartitionCookiesHandler):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html: Added.
* http/tests/loading/resourceLoadStatistics/resources: Added.
* http/tests/loading/resourceLoadStatistics/resources/get-cookies.php: Added.
* http/tests/loading/resourceLoadStatistics/resources/set-cookie.php: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadObservercpp">trunk/Source/WebCore/loader/ResourceLoadObserver.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadObserverh">trunk/Source/WebCore/loader/ResourceLoadObserver.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadStatisticsStorecpp">trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadStatisticsStoreh">trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkStorageSessionh">trunk/Source/WebCore/platform/network/NetworkStorageSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfNetworkStorageSessionCFNetcpp">trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessmessagesin">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscocoaNetworkDataTaskCocoamm">trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKCookieManagercpp">trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKCookieManagerh">trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKResourceLoadStatisticsManagercpp">trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKResourceLoadStatisticsManagerh">trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxyh">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebCookieManagerProxycpp">trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebCookieManagerProxyh">trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsManagercpp">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsManagerh">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStorecpp">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStoreh">trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStoreh">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllerh">trunk/Tools/WebKitTestRunner/TestController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsloadingresourceLoadStatisticspartitionedcookieswithandwithoutuserinteractionexpectedtxt">trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsloadingresourceLoadStatisticspartitionedcookieswithandwithoutuserinteractionhtml">trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html</a></li>
<li>trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/</li>
<li><a href="#trunkLayoutTestshttptestsloadingresourceLoadStatisticsresourcesgetcookiesphp">trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php</a></li>
<li><a href="#trunkLayoutTestshttptestsloadingresourceLoadStatisticsresourcessetcookiephp">trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/set-cookie.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/LayoutTests/ChangeLog        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2017-03-08  John Wilander  &lt;wilander@apple.com&gt;
+
+        Resource Load Statistics: Communicate to the network process which domains to partition
+        https://bugs.webkit.org/show_bug.cgi?id=169322
+        &lt;rdar://problem/30768921&gt;
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt: Added.
+        * http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html: Added.
+        * http/tests/loading/resourceLoadStatistics/resources: Added.
+        * http/tests/loading/resourceLoadStatistics/resources/get-cookies.php: Added.
+        * http/tests/loading/resourceLoadStatistics/resources/set-cookie.php: Added.
+
</ins><span class="cx"> 2017-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsloadingresourceLoadStatisticspartitionedcookieswithandwithoutuserinteractionexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt (0 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: Test for Partitioned Cookies With and Without User Interaction
+main frame - didChangeLocationWithinPageForFrame
+main frame - willPerformClientRedirectToURL: http://localhost:8000/loading/resourceLoadStatistics/resources/set-cookie.php?name=firstPartyCookie&amp;value=value#http://127.0.0.1:8000/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html#step2 
+main frame - didFinishDocumentLoadForFrame
+main frame - didFinishLoadForFrame
+main frame - didStartProvisionalLoadForFrame
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html#step2 
+main frame - didStartProvisionalLoadForFrame
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: Test for Partitioned Cookies With and Without User Interaction
+main frame - didChangeLocationWithinPageForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame0--&gt;--&gt;&quot; - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame0--&gt;--&gt;&quot; - didCommitLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame0--&gt;--&gt;&quot; - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didChangeLocationWithinPageForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame1--&gt;--&gt;&quot; - didStartProvisionalLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame0--&gt;--&gt;&quot; - didHandleOnloadEventsForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame0--&gt;--&gt;&quot; - didFinishLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame1--&gt;--&gt;&quot; - didCommitLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame1--&gt;--&gt;&quot; - didFinishDocumentLoadForFrame
+main frame - didChangeLocationWithinPageForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame2--&gt;--&gt;&quot; - didStartProvisionalLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame1--&gt;--&gt;&quot; - didHandleOnloadEventsForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame1--&gt;--&gt;&quot; - didFinishLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame2--&gt;--&gt;&quot; - didCommitLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame2--&gt;--&gt;&quot; - didFinishDocumentLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame3--&gt;--&gt;&quot; - didStartProvisionalLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame2--&gt;--&gt;&quot; - didHandleOnloadEventsForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame2--&gt;--&gt;&quot; - didFinishLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame3--&gt;--&gt;&quot; - didCommitLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame3--&gt;--&gt;&quot; - didFinishDocumentLoadForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame3--&gt;--&gt;&quot; - didHandleOnloadEventsForFrame
+frame &quot;&lt;!--framePath //&lt;!--frame3--&gt;--&gt;&quot; - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+  
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+Should receive no cookies.
+Did not receive cookie named 'firstPartyCookie'.
+Did not receive cookie named 'thirdPartyCookie'.
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame1--&gt;--&gt;'
+--------
+Setting partitioned, third party cookie.
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame2--&gt;--&gt;'
+--------
+Should only receive partitioned, third party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'thirdPartyCookie'.
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame3--&gt;--&gt;'
+--------
+After user interaction, should only receive non-partitioned, first party cookie.
+Received cookie named 'firstPartyCookie'.
+Did not receive cookie named 'thirdPartyCookie'.
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsloadingresourceLoadStatisticspartitionedcookieswithandwithoutuserinteractionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html (0 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html lang=&quot;en&quot;&gt;
+&lt;head&gt;
+    &lt;meta charset=&quot;UTF-8&quot;&gt;
+    &lt;title&gt;Test for Partitioned Cookies With and Without User Interaction&lt;/title&gt;
+    &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+    const partitionHost = &quot;127.0.0.1:8000&quot;;
+    const thirdPartyOrigin = &quot;http://localhost:8000&quot;;
+    const thirdPartyBaseUrl = thirdPartyOrigin + &quot;/loading/resourceLoadStatistics/resources&quot;;
+    const firstPartyCookieName = &quot;firstPartyCookie&quot;;
+    const subPathToSetFirstPartyCookie = &quot;/set-cookie.php?name=&quot; + firstPartyCookieName + &quot;&amp;value=value&quot;;
+    const thirdPartyCookieName = &quot;thirdPartyCookie&quot;;
+    const subPathToSetThirdPartyCookie = &quot;/set-cookie.php?name=&quot; + thirdPartyCookieName + &quot;&amp;value=value&quot;;
+    const fragmentWithReturnUrl = &quot;http://127.0.0.1:8000/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html&quot;;
+    const subPathToGetCookies = &quot;/get-cookies.php?name1=&quot; + firstPartyCookieName + &quot;&amp;name2=&quot; + thirdPartyCookieName;
+
+    function setEnableFeature(enable) {
+        if (!enable) {
+            testRunner.statisticsResetToConsistentState();
+        }
+        internals.setResourceLoadStatisticsEnabled(enable);
+        testRunner.setCookieStoragePartitioningEnabled(enable);
+    }
+
+    function finishTest() {
+        setEnableFeature(false);
+        testRunner.notifyDone();
+    }
+
+    function openIframe(url, onLoadHandler) {
+        const element = document.createElement(&quot;iframe&quot;);
+        element.src = url;
+        if (onLoadHandler) {
+            element.onload = onLoadHandler;
+        }
+        document.body.appendChild(element);
+    }
+
+    function setUserInteractionAndContinue() {
+        testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true);
+        if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
+            testFailed(&quot;Third party did not get logged for user interaction.&quot;);
+        runTest();
+    }
+
+    function runTest() {
+        switch (document.location.hash) {
+            case &quot;#step1&quot;:
+                document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + &quot;#&quot; + fragmentWithReturnUrl + &quot;#step2&quot;;
+                break;
+            case &quot;#step2&quot;:
+                document.location.hash = &quot;step3&quot;;
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + &quot;&amp;message=Should receive no cookies.&quot;, runTest);
+                break;
+            case &quot;#step3&quot;:
+                document.location.hash = &quot;step4&quot;;
+                openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + &quot;&amp;message=Setting partitioned, third party cookie.&quot;, runTest);
+                break;
+            case &quot;#step4&quot;:
+                document.location.hash = &quot;step5&quot;;
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + &quot;&amp;message=Should only receive partitioned, third party cookie.&quot;, setUserInteractionAndContinue);
+                break;
+            case &quot;#step5&quot;:
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + &quot;&amp;message=After user interaction, should only receive non-partitioned, first party cookie.&quot;, finishTest);
+                break;
+        }
+    }
+
+    if (document.location.host === partitionHost &amp;&amp; document.location.hash == &quot;&quot; &amp;&amp; window.testRunner &amp;&amp; window.internals) {
+        setEnableFeature(true);
+
+        testRunner.statisticsFireShouldPartitionCookiesHandler(&quot;localhost&quot;, true);
+
+        testRunner.waitUntilDone();
+        testRunner.dumpChildFramesAsText();
+        document.location.hash = &quot;step1&quot;;
+    }
+
+    runTest();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsloadingresourceLoadStatisticsresourcesgetcookiesphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php (0 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;?php
+echo $_GET[&quot;message&quot;] . &quot;&lt;br&gt;&quot;;
+if(!isset($_COOKIE[$_GET[&quot;name1&quot;]])) {
+    echo &quot;Did not receive cookie named '&quot; . $_GET[&quot;name1&quot;] . &quot;'.&lt;br&gt;&quot;;
+} else {
+    echo &quot;Received cookie named '&quot; . $_GET[&quot;name1&quot;] . &quot;'.&lt;br&gt;&quot;;
+}
+if(!isset($_COOKIE[$_GET[&quot;name2&quot;]])) {
+    echo &quot;Did not receive cookie named '&quot; . $_GET[&quot;name2&quot;] . &quot;'.&lt;br&gt;&quot;;
+} else {
+    echo &quot;Received cookie named '&quot; . $_GET[&quot;name2&quot;] . &quot;'.&lt;br&gt;&quot;;
+}
+?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsloadingresourceLoadStatisticsresourcessetcookiephp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/set-cookie.php (0 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/set-cookie.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/set-cookie.php        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;?php
+setcookie($_GET[&quot;name&quot;], $_GET[&quot;value&quot;], 0, &quot;/&quot;);
+echo $_GET[&quot;message&quot;] . &quot;&lt;br&gt;&quot;;
+?&gt;
+&lt;script&gt;
+if (document.location.hash) {
+    setTimeout(&quot;document.location.href = document.location.hash.substring(1)&quot;, 10);
+}
+&lt;/script&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebCore/ChangeLog        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2017-03-08  John Wilander  &lt;wilander@apple.com&gt;
+
+        Resource Load Statistics: Communicate to the network process which domains to partition
+        https://bugs.webkit.org/show_bug.cgi?id=169322
+        &lt;rdar://problem/30768921&gt;
+
+        Reviewed by Alex Christensen.
+
+        Test: http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html
+
+        * loader/ResourceLoadObserver.cpp:
+        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
+            Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
+            to tell the network process the domain has got user interaction.
+        (WebCore::ResourceLoadObserver::logUserInteraction):
+            Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
+            to tell the network process the domain has got user interaction.
+        (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
+            To allow TestRunner to set a domain for which
+            partitioning should be applied.
+        (WebCore::ResourceLoadObserver::primaryDomain):
+            New overloaded convenience function.
+        * loader/ResourceLoadObserver.h:
+        * loader/ResourceLoadStatisticsStore.cpp:
+        (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
+            Now bootstraps the network process' set of known domains to
+            partition cookies for.
+        (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
+        (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
+        (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
+            Now tells the network process to start partitioning again
+            when user interaction ages out.
+        * loader/ResourceLoadStatisticsStore.h:
+        * platform/network/NetworkStorageSession.h:
+        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+        (WebCore::NetworkStorageSession::shouldPartitionCookiesForHost):
+        (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
+
</ins><span class="cx"> 2017-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadObservercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -304,7 +304,9 @@
</span><span class="cx">     if (url.isBlankURL() || url.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto&amp; statistics = m_store-&gt;ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
</del><ins>+    auto primaryDomainStr = primaryDomain(url);
+
+    auto&amp; statistics = m_store-&gt;ensureResourceStatisticsForPrimaryDomain(primaryDomainStr);
</ins><span class="cx">     double newTimestamp = reduceTimeResolutionToOneDay(WTF::currentTime());
</span><span class="cx">     if (newTimestamp == statistics.mostRecentUserInteraction)
</span><span class="cx">         return;
</span><span class="lines">@@ -311,6 +313,8 @@
</span><span class="cx"> 
</span><span class="cx">     statistics.hadUserInteraction = true;
</span><span class="cx">     statistics.mostRecentUserInteraction = newTimestamp;
</span><ins>+
+    m_store-&gt;fireShouldPartitionCookiesHandler(primaryDomainStr, false);
</ins><span class="cx">     m_store-&gt;fireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -319,9 +323,13 @@
</span><span class="cx">     if (url.isBlankURL() || url.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto&amp; statistics = m_store-&gt;ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
</del><ins>+    auto primaryDomainStr = primaryDomain(url);
+
+    auto&amp; statistics = m_store-&gt;ensureResourceStatisticsForPrimaryDomain(primaryDomainStr);
</ins><span class="cx">     statistics.hadUserInteraction = true;
</span><span class="cx">     statistics.mostRecentUserInteraction = WTF::currentTime();
</span><ins>+
+    m_store-&gt;fireShouldPartitionCookiesHandler(primaryDomainStr, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceLoadObserver::clearUserInteraction(const URL&amp; url)
</span><span class="lines">@@ -412,10 +420,19 @@
</span><span class="cx">     m_store-&gt;fireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const String&amp; hostName, bool value)
+{
+    m_store-&gt;fireShouldPartitionCookiesHandler(primaryDomain(hostName), value);
+}
+
</ins><span class="cx"> String ResourceLoadObserver::primaryDomain(const URL&amp; url)
</span><span class="cx"> {
</span><ins>+    return primaryDomain(url.host());
+}
+
+String ResourceLoadObserver::primaryDomain(const String&amp; host)
+{
</ins><span class="cx">     String primaryDomain;
</span><del>-    String host = url.host();
</del><span class="cx">     if (host.isNull() || host.isEmpty())
</span><span class="cx">         primaryDomain = &quot;nullOrigin&quot;;
</span><span class="cx"> #if ENABLE(PUBLIC_SUFFIX_LIST)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadObserverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadObserver.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx">     WEBCORE_EXPORT void setReducedTimestampResolution(double seconds);
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void fireDataModificationHandler();
</span><ins>+    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String&amp; primaryDomain, bool value);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT RefPtr&lt;ResourceLoadStatisticsStore&gt; statisticsStore();
</span><span class="cx">     WEBCORE_EXPORT void setStatisticsStore(Ref&lt;ResourceLoadStatisticsStore&gt;&amp;&amp;);
</span><span class="lines">@@ -75,6 +76,7 @@
</span><span class="cx"> private:
</span><span class="cx">     bool shouldLog(Page*);
</span><span class="cx">     static String primaryDomain(const URL&amp;);
</span><ins>+    static String primaryDomain(const String&amp; host);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;ResourceLoadStatisticsStore&gt; m_store;
</span><span class="cx">     HashMap&lt;String, size_t&gt; m_originsVisitedMap;
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -100,8 +100,15 @@
</span><span class="cx">     if (!succeeded)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    for (auto&amp; statistics : loadedStatistics)
</del><ins>+    Vector&lt;String&gt; prevalentResourceDomainsWithoutUserInteraction;
+    prevalentResourceDomainsWithoutUserInteraction.reserveInitialCapacity(loadedStatistics.size());
+    for (auto&amp; statistics : loadedStatistics) {
</ins><span class="cx">         m_resourceStatisticsMap.set(statistics.highLevelDomain, statistics);
</span><ins>+        if (statistics.isPrevalentResource &amp;&amp; !statistics.hadUserInteraction)
+            prevalentResourceDomainsWithoutUserInteraction.uncheckedAppend(statistics.highLevelDomain);
+    }
+    
+    fireShouldPartitionCookiesHandler(prevalentResourceDomainsWithoutUserInteraction, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String ResourceLoadStatisticsStore::statisticsForOrigin(const String&amp; origin)
</span><span class="lines">@@ -141,6 +148,11 @@
</span><span class="cx">     m_dataAddedHandler = WTFMove(handler);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomains, bool value)&gt;&amp;&amp; handler)
+{
+    m_shouldPartitionCookiesForDomainsHandler = WTFMove(handler);
+}
+    
</ins><span class="cx"> void ResourceLoadStatisticsStore::fireDataModificationHandler()
</span><span class="cx"> {
</span><span class="cx">     if (m_dataAddedHandler)
</span><span class="lines">@@ -147,6 +159,19 @@
</span><span class="cx">         m_dataAddedHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const String&amp; primaryDomain, bool value)
+{
+    Vector&lt;String&gt; domainVector;
+    domainVector.append(primaryDomain);
+    fireShouldPartitionCookiesHandler(domainVector, value);
+}
+
+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; primaryDomains, bool value)
+{
+    if (m_shouldPartitionCookiesForDomainsHandler)
+        m_shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
+}
+
</ins><span class="cx"> void ResourceLoadStatisticsStore::setTimeToLiveUserInteraction(double seconds)
</span><span class="cx"> {
</span><span class="cx">     if (seconds &gt;= 0)
</span><span class="lines">@@ -170,6 +195,10 @@
</span><span class="cx">         // it has been reset as opposed to its default -1.
</span><span class="cx">         resourceStatistic.mostRecentUserInteraction = 0;
</span><span class="cx">         resourceStatistic.hadUserInteraction = false;
</span><ins>+
+        if (resourceStatistic.isPrevalentResource)
+            fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
+
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebCore/loader/ResourceLoadStatisticsStore.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -56,10 +56,13 @@
</span><span class="cx">     WEBCORE_EXPORT void mergeStatistics(const Vector&lt;ResourceLoadStatistics&gt;&amp;);
</span><span class="cx">     WEBCORE_EXPORT Vector&lt;ResourceLoadStatistics&gt; takeStatistics();
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT void setNotificationCallback(std::function&lt;void()&gt; handler);
</del><ins>+    WEBCORE_EXPORT void setNotificationCallback(std::function&lt;void()&gt;);
+    WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomains, bool value)&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void fireDataModificationHandler();
</span><span class="cx">     void setTimeToLiveUserInteraction(double seconds);
</span><ins>+    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const String&amp; primaryDomain, bool value);
+    WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector&lt;String&gt;&amp; primaryDomain, bool value);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void processStatistics(std::function&lt;void(ResourceLoadStatistics&amp;)&gt;&amp;&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -71,6 +74,7 @@
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;String, ResourceLoadStatistics&gt; m_resourceStatisticsMap;
</span><span class="cx">     std::function&lt;void()&gt; m_dataAddedHandler;
</span><ins>+    std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomains, bool value)&gt; m_shouldPartitionCookiesForDomainsHandler;
</ins><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CredentialStorage.h&quot;
</span><span class="cx"> #include &quot;SessionID.h&quot;
</span><ins>+#include &lt;wtf/HashSet.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA) || USE(CFURLCONNECTION)
</span><span class="lines">@@ -67,6 +68,10 @@
</span><span class="cx">     CFURLStorageSessionRef platformSession() { return m_platformSession.get(); }
</span><span class="cx">     WEBCORE_EXPORT RetainPtr&lt;CFHTTPCookieStorageRef&gt; cookieStorage() const;
</span><span class="cx">     WEBCORE_EXPORT static void setCookieStoragePartitioningEnabled(bool);
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    WEBCORE_EXPORT bool shouldPartitionCookiesForHost(const String&amp;);
+    WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp;, bool value);
+#endif
</ins><span class="cx"> #elif USE(SOUP)
</span><span class="cx">     NetworkStorageSession(SessionID, std::unique_ptr&lt;SoupNetworkSession&gt;&amp;&amp;);
</span><span class="cx">     ~NetworkStorageSession();
</span><span class="lines">@@ -106,6 +111,10 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     CredentialStorage m_credentialStorage;
</span><ins>+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    HashSet&lt;String&gt; m_topPrivatelyControlledDomainsForCookiePartitioning;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WEBCORE_EXPORT String cookieStoragePartition(const ResourceRequest&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfNetworkStorageSessionCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -140,4 +140,30 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+
+bool NetworkStorageSession::shouldPartitionCookiesForHost(const String&amp; host)
+{
+    if (host.isEmpty())
+        return false;
+
+    auto domain = topPrivatelyControlledDomain(host);
+    if (domain.isEmpty())
+        domain = host;
+
+    return m_topPrivatelyControlledDomainsForCookiePartitioning.contains(domain);
</ins><span class="cx"> }
</span><ins>+
+void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp; hosts, bool value)
+{
+    if (value)
+        m_topPrivatelyControlledDomainsForCookiePartitioning.add(hosts.begin(), hosts.end());
+    else {
+        for (auto&amp; host : hosts)
+            m_topPrivatelyControlledDomainsForCookiePartitioning.remove(host);
+    }
+}
+
+#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2017-03-08  John Wilander  &lt;wilander@apple.com&gt;
+
+        Resource Load Statistics: Communicate to the network process which domains to partition
+        https://bugs.webkit.org/show_bug.cgi?id=169322
+        &lt;rdar://problem/30768921&gt;
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+            Now consults WebCore::NetworkStorageSession::shouldPartitionCookiesForHost()
+            to decide whether partitioning should be applied or not.
+        * UIProcess/API/C/WKCookieManager.cpp:
+        (WKCookieManagerSetCookieStoragePartitioningEnabled):
+            To allow TestRunner to configure cookie partitioning.
+        * UIProcess/API/C/WKCookieManager.h:
+        * UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
+        (WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
+            To allow TestRunner to set a domain for which
+            partitioning should be applied.
+        * UIProcess/API/C/WKResourceLoadStatisticsManager.h:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.messages.in:
+        * UIProcess/WebCookieManagerProxy.cpp:
+        (WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled):
+            To allow TestRunner to configure cookie partitioning.
+        * UIProcess/WebCookieManagerProxy.h:
+        * UIProcess/WebResourceLoadStatisticsManager.cpp:
+        (WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
+            To allow TestRunner to set a domain for which
+            partitioning should be applied.
+        * UIProcess/WebResourceLoadStatisticsManager.h:
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::classifyResource):
+            Now tells the network process as soon as a domain
+            has been classified as prevalent.
+        (WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
+            Overloaded function to allow injection of handlers for communication with the
+            network process.
+        * UIProcess/WebResourceLoadStatisticsStore.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
+        (WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
+            Now sets two callback handlers for communication with the network process.
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+
</ins><span class="cx"> 2017-03-08  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix -Wattributes warning spam
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -310,6 +310,13 @@
</span><span class="cx">         handler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+void NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; domains, bool value)
+{
+    NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domains, value);
+}
+#endif
+
</ins><span class="cx"> static void fetchDiskCacheEntries(SessionID sessionID, OptionSet&lt;WebsiteDataFetchOption&gt; fetchOptions, Function&lt;void (Vector&lt;WebsiteData::Entry&gt;)&gt;&amp;&amp; completionHandler)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -116,6 +116,10 @@
</span><span class="cx"> 
</span><span class="cx">     void grantSandboxExtensionsToDatabaseProcessForBlobs(const Vector&lt;String&gt;&amp; filenames, Function&lt;void ()&gt;&amp;&amp; completionHandler);
</span><span class="cx"> 
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp;, bool value);
+#endif
+
</ins><span class="cx">     std::chrono::milliseconds loadThrottleLatency() const { return m_loadThrottleLatency; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -77,4 +77,8 @@
</span><span class="cx">     ProcessDidResume()
</span><span class="cx"> 
</span><span class="cx">     DidGrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID)
</span><ins>+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector&lt;String&gt; topPrivatelyOwnedDomains, bool value)
+#endif
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscocoaNetworkDataTaskCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -123,9 +123,12 @@
</span><span class="cx">     LOG(NetworkSession, &quot;%llu Creating NetworkDataTask with URL %s&quot;, [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    String storagePartition = WebCore::cookieStoragePartition(request);
-    if (!storagePartition.isEmpty())
-        m_task.get()._storagePartitionIdentifier = storagePartition;
</del><ins>+    if (session.networkStorageSession().shouldPartitionCookiesForHost(url.host())) {
+        LOG(NetworkSession, &quot;%llu Partitioning cookies for URL %s&quot;, [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
+        String storagePartition = WebCore::cookieStoragePartition(request);
+        if (!storagePartition.isEmpty())
+            m_task.get()._storagePartitionIdentifier = storagePartition;
+    }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (WebCore::ResourceRequest::resourcePrioritiesEnabled())
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKCookieManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -74,6 +74,11 @@
</span><span class="cx">     toImpl(cookieManager)-&gt;getHTTPCookieAcceptPolicy(toGenericCallbackFunction&lt;WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy&gt;(context, callback));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WKCookieManagerSetCookieStoragePartitioningEnabled(WKCookieManagerRef cookieManager, bool enabled)
+{
+    toImpl(cookieManager)-&gt;setCookieStoragePartitioningEnabled(enabled);
+}
+
</ins><span class="cx"> void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager)
</span><span class="cx"> {
</span><span class="cx">     toImpl(cookieManager)-&gt;startObservingCookieChanges(WebCore::SessionID::defaultSessionID());
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKCookieManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -72,6 +72,8 @@
</span><span class="cx"> typedef void (*WKCookieManagerGetHTTPCookieAcceptPolicyFunction)(WKHTTPCookieAcceptPolicy, WKErrorRef, void*);
</span><span class="cx"> WK_EXPORT void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback);
</span><span class="cx"> 
</span><ins>+WK_EXPORT void WKCookieManagerSetCookieStoragePartitioningEnabled(WKCookieManagerRef cookieManager, bool enabled);
+
</ins><span class="cx"> WK_EXPORT void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager);
</span><span class="cx"> WK_EXPORT void WKCookieManagerStopObservingCookieChanges(WKCookieManagerRef cookieManager);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKResourceLoadStatisticsManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -81,6 +81,11 @@
</span><span class="cx">     WebResourceLoadStatisticsManager::fireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value)
+{
+    WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(toWTFString(hostName), value);
+}
+
</ins><span class="cx"> void WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned(bool value)
</span><span class="cx"> {
</span><span class="cx">     WebResourceLoadStatisticsManager::setNotifyPagesWhenDataRecordsWereScanned(value);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKResourceLoadStatisticsManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKResourceLoadStatisticsManager.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">     WK_EXPORT void WKResourceLoadStatisticsManagerSetSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo);
</span><span class="cx">     WK_EXPORT void WKResourceLoadStatisticsManagerSetTimeToLiveUserInteraction(double seconds);
</span><span class="cx">     WK_EXPORT void WKResourceLoadStatisticsManagerFireDataModificationHandler();
</span><ins>+    WK_EXPORT void WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value);
</ins><span class="cx">     WK_EXPORT void WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned(bool value);
</span><span class="cx">     WK_EXPORT void WKResourceLoadStatisticsManagerSetShouldClassifyResourcesBeforeDataRecordsRemoval(bool value);
</span><span class="cx">     WK_EXPORT void WKResourceLoadStatisticsManagerSetMinimumTimeBetweeenDataRecordsRemoval(double seconds);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -292,6 +292,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+void NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, bool value)
+{
+    connection()-&gt;send(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value), 0);
+}
+#endif
+
</ins><span class="cx"> void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
</span><span class="cx"> {
</span><span class="cx">     ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -109,6 +109,9 @@
</span><span class="cx">     void didDeleteWebsiteData(uint64_t callbackID);
</span><span class="cx">     void didDeleteWebsiteDataForOrigins(uint64_t callbackID);
</span><span class="cx">     void grantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, const Vector&lt;String&gt;&amp; paths);
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp;, bool value);
+#endif
</ins><span class="cx">     void logDiagnosticMessage(uint64_t pageID, const String&amp; message, const String&amp; description, WebCore::ShouldSample);
</span><span class="cx">     void logDiagnosticMessageWithResult(uint64_t pageID, const String&amp; message, const String&amp; description, uint32_t result, WebCore::ShouldSample);
</span><span class="cx">     void logDiagnosticMessageWithValue(uint64_t pageID, const String&amp; message, const String&amp; description, double value, unsigned significantFigures, WebCore::ShouldSample);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -31,6 +31,10 @@
</span><span class="cx"> 
</span><span class="cx">     GrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID, Vector&lt;String&gt; paths)
</span><span class="cx"> 
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector&lt;String&gt; topPrivatelyOwnedDomains, bool value)
+#endif
+
</ins><span class="cx">     ProcessReadyToSuspend()
</span><span class="cx">     SetIsHoldingLockedFiles(bool isHoldingLockedFiles)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebCookieManagerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIArray.h&quot;
</span><span class="cx"> #include &quot;APISecurityOrigin.h&quot;
</span><ins>+#include &quot;NetworkProcessMessages.h&quot;
</ins><span class="cx"> #include &quot;WebCookieManagerMessages.h&quot;
</span><span class="cx"> #include &quot;WebCookieManagerProxyMessages.h&quot;
</span><span class="cx"> #include &quot;WebProcessPool.h&quot;
</span><span class="lines">@@ -196,4 +197,13 @@
</span><span class="cx">     callback-&gt;performCallbackWithReturnValue(policy);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebCookieManagerProxy::setCookieStoragePartitioningEnabled(bool enabled)
+{
+#if PLATFORM(COCOA)
+    processPool()-&gt;sendToNetworkingProcess(Messages::NetworkProcess::SetCookieStoragePartitioningEnabled(enabled));
+#else
+    UNUSED_PARAM(enabled);
+#endif
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebCookieManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx"> 
</span><span class="cx">     void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
</span><span class="cx">     void getHTTPCookieAcceptPolicy(std::function&lt;void (HTTPCookieAcceptPolicy, CallbackBase::Error)&gt;);
</span><ins>+    void setCookieStoragePartitioningEnabled(bool);
</ins><span class="cx"> 
</span><span class="cx">     void startObservingCookieChanges(WebCore::SessionID);
</span><span class="cx">     void stopObservingCookieChanges(WebCore::SessionID);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -86,6 +86,11 @@
</span><span class="cx">     WebCore::ResourceLoadObserver::sharedObserver().fireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler(const String&amp; hostName, bool value)
+{
+    WebCore::ResourceLoadObserver::sharedObserver().fireShouldPartitionCookiesHandler(hostName, value);
+}
+
</ins><span class="cx"> void WebResourceLoadStatisticsManager::setNotifyPagesWhenDataRecordsWereScanned(bool value)
</span><span class="cx"> {
</span><span class="cx">     WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned(value);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsManager.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">     static void setTimeToLiveUserInteraction(double seconds);
</span><span class="cx">     static void setReducedTimestampResolution(double seconds);
</span><span class="cx">     static void fireDataModificationHandler();
</span><ins>+    static void fireShouldPartitionCookiesHandler(const String&amp; hostName, bool value);
</ins><span class="cx">     static void setNotifyPagesWhenDataRecordsWereScanned(bool);
</span><span class="cx">     static void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value);
</span><span class="cx">     static void setMinimumTimeBetweeenDataRecordsRemoval(double seconds);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -85,8 +85,11 @@
</span><span class="cx"> void WebResourceLoadStatisticsStore::classifyResource(ResourceLoadStatistics&amp; resourceStatistic)
</span><span class="cx"> {
</span><span class="cx">     if (!resourceStatistic.isPrevalentResource
</span><del>-        &amp;&amp; m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
</del><ins>+        &amp;&amp; m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic)) {
</ins><span class="cx">         resourceStatistic.isPrevalentResource = true;
</span><ins>+        if (!resourceStatistic.hadUserInteraction)
+            m_resourceLoadStatisticsStore-&gt;fireShouldPartitionCookiesHandler(resourceStatistic.highLevelDomain, true);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebResourceLoadStatisticsStore::removeDataRecords()
</span><span class="lines">@@ -170,7 +173,6 @@
</span><span class="cx">     return m_resourceLoadStatisticsEnabled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver()
</span><span class="cx"> {
</span><span class="cx">     ResourceLoadObserver::sharedObserver().setStatisticsStore(m_resourceLoadStatisticsStore.copyRef());
</span><span class="lines">@@ -180,6 +182,14 @@
</span><span class="cx">         processStatisticsAndDataRecords();
</span><span class="cx">     });
</span><span class="cx"> }
</span><ins>+    
+void WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomain, bool value)&gt;&amp;&amp; shouldPartitionCookiesForDomainsHandler)
+{
+    registerSharedResourceLoadObserver();
+    m_resourceLoadStatisticsStore-&gt;setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector&lt;String&gt;&amp; primaryDomains, bool value) {
+        shouldPartitionCookiesForDomainsHandler(primaryDomains, value);
+    });
+}
</ins><span class="cx"> 
</span><span class="cx"> void WebResourceLoadStatisticsStore::readDataFromDiskIfNeeded()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx">     void setResourceLoadStatisticsEnabled(bool);
</span><span class="cx">     bool resourceLoadStatisticsEnabled() const;
</span><span class="cx">     void registerSharedResourceLoadObserver();
</span><ins>+    void registerSharedResourceLoadObserver(std::function&lt;void(const Vector&lt;String&gt;&amp; primaryDomain, bool value)&gt;&amp;&amp; shouldPartitionCookiesForDomainsHandler);
</ins><span class="cx">     
</span><span class="cx">     void resourceLoadStatisticsUpdated(const Vector&lt;WebCore::ResourceLoadStatistics&gt;&amp; origins);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -1048,6 +1048,14 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+void WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, bool value)
+{
+    for (auto&amp; processPool : processPools())
+        processPool-&gt;sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value));
+}
+#endif
+
</ins><span class="cx"> void WebsiteDataStore::webPageWasAdded(WebPageProxy&amp; webPageProxy)
</span><span class="cx"> {
</span><span class="cx">     if (m_storageManager)
</span><span class="lines">@@ -1212,8 +1220,15 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_resourceLoadStatistics)
</span><span class="cx">         return;
</span><del>-
</del><ins>+    
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    m_resourceLoadStatistics-&gt;registerSharedResourceLoadObserver(
+        [this] (const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, bool value) {
+            this-&gt;shouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value);
+        });
+#else
</ins><span class="cx">     m_resourceLoadStatistics-&gt;registerSharedResourceLoadObserver();
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -90,6 +90,9 @@
</span><span class="cx">     void removeData(OptionSet&lt;WebsiteDataType&gt;, const Vector&lt;WebsiteDataRecord&gt;&amp;, std::function&lt;void ()&gt; completionHandler);
</span><span class="cx">     void removeDataForTopPrivatelyOwnedDomains(OptionSet&lt;WebsiteDataType&gt;, OptionSet&lt;WebsiteDataFetchOption&gt;, const Vector&lt;String&gt;&amp; topPrivatelyOwnedDomains, std::function&lt;void(Vector&lt;String&gt;)&gt; completionHandler);
</span><span class="cx"> 
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+    void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector&lt;String&gt;&amp;, bool value);
+#endif
</ins><span class="cx">     void resolveDirectoriesIfNecessary();
</span><span class="cx">     const String&amp; resolvedApplicationCacheDirectory() const { return m_resolvedConfiguration.applicationCacheDirectory; }
</span><span class="cx">     const String&amp; resolvedMediaCacheDirectory() const { return m_resolvedConfiguration.mediaCacheDirectory; }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Tools/ChangeLog        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2017-03-08  John Wilander  &lt;wilander@apple.com&gt;
+
+        Resource Load Statistics: Communicate to the network process which domains to partition
+        https://bugs.webkit.org/show_bug.cgi?id=169322
+        &lt;rdar://problem/30768921&gt;
+
+        Reviewed by Alex Christensen.
+
+        These changes add support for two new TestRunner functions:
+        - setCookieStoragePartitioningEnabled()
+        - statisticsFireShouldPartitionCookiesHandler()
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setCookieStoragePartitioningEnabled):
+        (WTR::TestRunner::statisticsFireShouldPartitionCookiesHandler):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::statisticsFireShouldPartitionCookiesHandler):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
</ins><span class="cx"> 2017-03-08  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Enable async image decoding for large images
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -163,6 +163,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Cookies testing
</span><span class="cx">     void setAlwaysAcceptCookies(boolean accept);
</span><ins>+    void setCookieStoragePartitioningEnabled(boolean enabled);
</ins><span class="cx"> 
</span><span class="cx">     void overridePreference(DOMString preference, DOMString value);
</span><span class="cx"> 
</span><span class="lines">@@ -258,6 +259,7 @@
</span><span class="cx">     void setStatisticsSubresourceUniqueRedirectTo(DOMString hostName, DOMString hostNameRedirectedTo);
</span><span class="cx">     void setStatisticsTimeToLiveUserInteraction(double seconds);
</span><span class="cx">     void statisticsFireDataModificationHandler();
</span><ins>+    void statisticsFireShouldPartitionCookiesHandler(DOMString hostName, boolean value);
</ins><span class="cx">     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(boolean value);
</span><span class="cx">     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(boolean value);
</span><span class="cx">     void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double seconds);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -766,6 +766,15 @@
</span><span class="cx">     WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::setCookieStoragePartitioningEnabled(bool enabled)
+{
+    WKRetainPtr&lt;WKStringRef&gt; messageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;SetCookieStoragePartitioningEnabled&quot;));
+
+    WKRetainPtr&lt;WKBooleanRef&gt; messageBody(AdoptWK, WKBooleanCreate(enabled));
+
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
</ins><span class="cx"> double TestRunner::preciseTime()
</span><span class="cx"> {
</span><span class="cx">     return currentTime();
</span><span class="lines">@@ -1328,6 +1337,31 @@
</span><span class="cx">     WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::statisticsFireShouldPartitionCookiesHandler(JSStringRef hostName, bool value)
+{
+    Vector&lt;WKRetainPtr&lt;WKStringRef&gt;&gt; keys;
+    Vector&lt;WKRetainPtr&lt;WKTypeRef&gt;&gt; values;
+    
+    keys.append({ AdoptWK, WKStringCreateWithUTF8CString(&quot;HostName&quot;) });
+    values.append({ AdoptWK, WKStringCreateWithJSString(hostName) });
+    
+    keys.append({ AdoptWK, WKStringCreateWithUTF8CString(&quot;Value&quot;) });
+    values.append({ AdoptWK, WKBooleanCreate(value) });
+    
+    Vector&lt;WKStringRef&gt; rawKeys(keys.size());
+    Vector&lt;WKTypeRef&gt; rawValues(values.size());
+    
+    for (size_t i = 0; i &lt; keys.size(); ++i) {
+        rawKeys[i] = keys[i].get();
+        rawValues[i] = values[i].get();
+    }
+    
+    WKRetainPtr&lt;WKStringRef&gt; messageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;StatisticsFireShouldPartitionCookiesHandler&quot;));
+    WKRetainPtr&lt;WKDictionaryRef&gt; messageBody(AdoptWK, WKDictionaryCreate(rawKeys.data(), rawValues.data(), rawKeys.size()));
+    
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
</ins><span class="cx"> void TestRunner::setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool value)
</span><span class="cx"> {
</span><span class="cx">     WKRetainPtr&lt;WKStringRef&gt; messageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;StatisticsNotifyPagesWhenDataRecordsWereScanned&quot;));
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -271,6 +271,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Cookies testing
</span><span class="cx">     void setAlwaysAcceptCookies(bool);
</span><ins>+    void setCookieStoragePartitioningEnabled(bool);
</ins><span class="cx"> 
</span><span class="cx">     // Custom full screen behavior.
</span><span class="cx">     void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; }
</span><span class="lines">@@ -351,6 +352,7 @@
</span><span class="cx">     void installStatisticsDidModifyDataRecordsCallback(JSValueRef callback);
</span><span class="cx">     void statisticsDidModifyDataRecordsCallback();
</span><span class="cx">     void statisticsFireDataModificationHandler();
</span><ins>+    void statisticsFireShouldPartitionCookiesHandler(JSStringRef hostName, bool value);
</ins><span class="cx">     void setStatisticsPrevalentResource(JSStringRef hostName, bool value);
</span><span class="cx">     bool isStatisticsPrevalentResource(JSStringRef hostName);
</span><span class="cx">     void setStatisticsHasHadUserInteraction(JSStringRef hostName, bool value);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -2270,6 +2270,11 @@
</span><span class="cx">     WKResourceLoadStatisticsManagerFireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx">     
</span><ins>+void TestController::statisticsFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value)
+{
+    WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler(hostName, value);
+}
+
</ins><span class="cx"> void TestController::setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool value)
</span><span class="cx"> {
</span><span class="cx">     WKResourceLoadStatisticsManagerSetNotifyPagesWhenDataRecordsWereScanned(value);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.h (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.h        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Tools/WebKitTestRunner/TestController.h        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -157,6 +157,7 @@
</span><span class="cx">     void setStatisticsSubresourceUniqueRedirectTo(WKStringRef hostName, WKStringRef hostNameRedirectedTo);
</span><span class="cx">     void setStatisticsTimeToLiveUserInteraction(double seconds);
</span><span class="cx">     void statisticsFireDataModificationHandler();
</span><ins>+    void statisticsFireShouldPartitionCookiesHandler(WKStringRef hostName, bool value);
</ins><span class="cx">     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
</span><span class="cx">     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
</span><span class="cx">     void setStatisticsMinimumTimeBetweeenDataRecordsRemoval(double);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (213622 => 213623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2017-03-09 03:44:17 UTC (rev 213622)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2017-03-09 04:02:14 UTC (rev 213623)
</span><span class="lines">@@ -793,6 +793,12 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, &quot;SetCookieStoragePartitioningEnabled&quot;)) {
+        WKBooleanRef accept = static_cast&lt;WKBooleanRef&gt;(messageBody);
+        WKCookieManagerSetCookieStoragePartitioningEnabled(WKContextGetCookieManager(TestController::singleton().context()), WKBooleanGetValue(accept));
+        return nullptr;
+    }
+    
</ins><span class="cx">     if (WKStringIsEqualToUTF8CString(messageName, &quot;ImageCountInGeneralPasteboard&quot;)) {
</span><span class="cx">         unsigned count = TestController::singleton().imageCountInGeneralPasteboard();
</span><span class="cx">         WKRetainPtr&lt;WKUInt64Ref&gt; result(AdoptWK, WKUInt64Create(count));
</span><span class="lines">@@ -991,6 +997,20 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, &quot;StatisticsFireShouldPartitionCookiesHandler&quot;)) {
+        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+        
+        WKDictionaryRef messageBodyDictionary = static_cast&lt;WKDictionaryRef&gt;(messageBody);
+        WKRetainPtr&lt;WKStringRef&gt; hostNameKey(AdoptWK, WKStringCreateWithUTF8CString(&quot;HostName&quot;));
+        WKRetainPtr&lt;WKStringRef&gt; valueKey(AdoptWK, WKStringCreateWithUTF8CString(&quot;Value&quot;));
+        
+        WKStringRef hostName = static_cast&lt;WKStringRef&gt;(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameKey.get()));
+        WKBooleanRef value = static_cast&lt;WKBooleanRef&gt;(WKDictionaryGetItemForKey(messageBodyDictionary, valueKey.get()));
+        
+        TestController::singleton().statisticsFireShouldPartitionCookiesHandler(hostName, WKBooleanGetValue(value));
+        return nullptr;
+    }
+    
</ins><span class="cx">     if (WKStringIsEqualToUTF8CString(messageName, &quot;StatisticsNotifyPagesWhenDataRecordsWereScanned&quot;)) {
</span><span class="cx">         ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
</span><span class="cx">         WKBooleanRef value = static_cast&lt;WKBooleanRef&gt;(messageBody);
</span></span></pre>
</div>
</div>

</body>
</html>