<!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
<rdar://problem/30768921>
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 <wilander@apple.com>
+
+ Resource Load Statistics: Communicate to the network process which domains to partition
+ https://bugs.webkit.org/show_bug.cgi?id=169322
+ <rdar://problem/30768921>
+
+ 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 <pecoraro@apple.com>
</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&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 "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame1-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didFinishDocumentLoadForFrame
+main frame - didChangeLocationWithinPageForFrame
+frame "<!--framePath //<!--frame2-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame1-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame1-->-->" - didFinishLoadForFrame
+frame "<!--framePath //<!--frame2-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame2-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame3-->-->" - didStartProvisionalLoadForFrame
+frame "<!--framePath //<!--frame2-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame2-->-->" - didFinishLoadForFrame
+frame "<!--framePath //<!--frame3-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame3-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame3-->-->" - didHandleOnloadEventsForFrame
+frame "<!--framePath //<!--frame3-->-->" - didFinishLoadForFrame
+main frame - didFinishLoadForFrame
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+Should receive no cookies.
+Did not receive cookie named 'firstPartyCookie'.
+Did not receive cookie named 'thirdPartyCookie'.
+
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+Setting partitioned, third party cookie.
+
+
+--------
+Frame: '<!--framePath //<!--frame2-->-->'
+--------
+Should only receive partitioned, third party cookie.
+Did not receive cookie named 'firstPartyCookie'.
+Received cookie named 'thirdPartyCookie'.
+
+
+--------
+Frame: '<!--framePath //<!--frame3-->-->'
+--------
+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>+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Test for Partitioned Cookies With and Without User Interaction</title>
+ <script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+ const partitionHost = "127.0.0.1:8000";
+ const thirdPartyOrigin = "http://localhost:8000";
+ const thirdPartyBaseUrl = thirdPartyOrigin + "/loading/resourceLoadStatistics/resources";
+ const firstPartyCookieName = "firstPartyCookie";
+ const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
+ const thirdPartyCookieName = "thirdPartyCookie";
+ const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value";
+ const fragmentWithReturnUrl = "http://127.0.0.1:8000/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html";
+ const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + 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("iframe");
+ element.src = url;
+ if (onLoadHandler) {
+ element.onload = onLoadHandler;
+ }
+ document.body.appendChild(element);
+ }
+
+ function setUserInteractionAndContinue() {
+ testRunner.setStatisticsHasHadUserInteraction(thirdPartyOrigin, true);
+ if (!testRunner.isStatisticsHasHadUserInteraction(thirdPartyOrigin))
+ testFailed("Third party did not get logged for user interaction.");
+ runTest();
+ }
+
+ function runTest() {
+ switch (document.location.hash) {
+ case "#step1":
+ document.location.href = thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "#" + fragmentWithReturnUrl + "#step2";
+ break;
+ case "#step2":
+ document.location.hash = "step3";
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive no cookies.", runTest);
+ break;
+ case "#step3":
+ document.location.hash = "step4";
+ openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Setting partitioned, third party cookie.", runTest);
+ break;
+ case "#step4":
+ document.location.hash = "step5";
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should only receive partitioned, third party cookie.", setUserInteractionAndContinue);
+ break;
+ case "#step5":
+ openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=After user interaction, should only receive non-partitioned, first party cookie.", finishTest);
+ break;
+ }
+ }
+
+ if (document.location.host === partitionHost && document.location.hash == "" && window.testRunner && window.internals) {
+ setEnableFeature(true);
+
+ testRunner.statisticsFireShouldPartitionCookiesHandler("localhost", true);
+
+ testRunner.waitUntilDone();
+ testRunner.dumpChildFramesAsText();
+ document.location.hash = "step1";
+ }
+
+ runTest();
+</script>
+</body>
+</html>
</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>+<?php
+echo $_GET["message"] . "<br>";
+if(!isset($_COOKIE[$_GET["name1"]])) {
+ echo "Did not receive cookie named '" . $_GET["name1"] . "'.<br>";
+} else {
+ echo "Received cookie named '" . $_GET["name1"] . "'.<br>";
+}
+if(!isset($_COOKIE[$_GET["name2"]])) {
+ echo "Did not receive cookie named '" . $_GET["name2"] . "'.<br>";
+} else {
+ echo "Received cookie named '" . $_GET["name2"] . "'.<br>";
+}
+?>
</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>+<?php
+setcookie($_GET["name"], $_GET["value"], 0, "/");
+echo $_GET["message"] . "<br>";
+?>
+<script>
+if (document.location.hash) {
+ setTimeout("document.location.href = document.location.hash.substring(1)", 10);
+}
+</script>
</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 <wilander@apple.com>
+
+ Resource Load Statistics: Communicate to the network process which domains to partition
+ https://bugs.webkit.org/show_bug.cgi?id=169322
+ <rdar://problem/30768921>
+
+ 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 <pecoraro@apple.com>
</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& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
</del><ins>+ auto primaryDomainStr = primaryDomain(url);
+
+ auto& statistics = m_store->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->fireShouldPartitionCookiesHandler(primaryDomainStr, false);
</ins><span class="cx"> m_store->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& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomain(url));
</del><ins>+ auto primaryDomainStr = primaryDomain(url);
+
+ auto& statistics = m_store->ensureResourceStatisticsForPrimaryDomain(primaryDomainStr);
</ins><span class="cx"> statistics.hadUserInteraction = true;
</span><span class="cx"> statistics.mostRecentUserInteraction = WTF::currentTime();
</span><ins>+
+ m_store->fireShouldPartitionCookiesHandler(primaryDomainStr, false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ResourceLoadObserver::clearUserInteraction(const URL& url)
</span><span class="lines">@@ -412,10 +420,19 @@
</span><span class="cx"> m_store->fireDataModificationHandler();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ResourceLoadObserver::fireShouldPartitionCookiesHandler(const String& hostName, bool value)
+{
+ m_store->fireShouldPartitionCookiesHandler(primaryDomain(hostName), value);
+}
+
</ins><span class="cx"> String ResourceLoadObserver::primaryDomain(const URL& url)
</span><span class="cx"> {
</span><ins>+ return primaryDomain(url.host());
+}
+
+String ResourceLoadObserver::primaryDomain(const String& 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 = "nullOrigin";
</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& primaryDomain, bool value);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT RefPtr<ResourceLoadStatisticsStore> statisticsStore();
</span><span class="cx"> WEBCORE_EXPORT void setStatisticsStore(Ref<ResourceLoadStatisticsStore>&&);
</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&);
</span><ins>+ static String primaryDomain(const String& host);
</ins><span class="cx">
</span><span class="cx"> RefPtr<ResourceLoadStatisticsStore> m_store;
</span><span class="cx"> HashMap<String, size_t> 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& statistics : loadedStatistics)
</del><ins>+ Vector<String> prevalentResourceDomainsWithoutUserInteraction;
+ prevalentResourceDomainsWithoutUserInteraction.reserveInitialCapacity(loadedStatistics.size());
+ for (auto& statistics : loadedStatistics) {
</ins><span class="cx"> m_resourceStatisticsMap.set(statistics.highLevelDomain, statistics);
</span><ins>+ if (statistics.isPrevalentResource && !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& 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<void(const Vector<String>& primaryDomains, bool value)>&& 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& primaryDomain, bool value)
+{
+ Vector<String> domainVector;
+ domainVector.append(primaryDomain);
+ fireShouldPartitionCookiesHandler(domainVector, value);
+}
+
+void ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler(const Vector<String>& 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 >= 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<ResourceLoadStatistics>&);
</span><span class="cx"> WEBCORE_EXPORT Vector<ResourceLoadStatistics> takeStatistics();
</span><span class="cx">
</span><del>- WEBCORE_EXPORT void setNotificationCallback(std::function<void()> handler);
</del><ins>+ WEBCORE_EXPORT void setNotificationCallback(std::function<void()>);
+ WEBCORE_EXPORT void setShouldPartitionCookiesCallback(std::function<void(const Vector<String>& primaryDomains, bool value)>&&);
</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& primaryDomain, bool value);
+ WEBCORE_EXPORT void fireShouldPartitionCookiesHandler(const Vector<String>& primaryDomain, bool value);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void processStatistics(std::function<void(ResourceLoadStatistics&)>&&);
</span><span class="cx">
</span><span class="lines">@@ -71,6 +74,7 @@
</span><span class="cx">
</span><span class="cx"> HashMap<String, ResourceLoadStatistics> m_resourceStatisticsMap;
</span><span class="cx"> std::function<void()> m_dataAddedHandler;
</span><ins>+ std::function<void(const Vector<String>& primaryDomains, bool value)> 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 "CredentialStorage.h"
</span><span class="cx"> #include "SessionID.h"
</span><ins>+#include <wtf/HashSet.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</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<CFHTTPCookieStorageRef> 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&);
+ WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector<String>&, bool value);
+#endif
</ins><span class="cx"> #elif USE(SOUP)
</span><span class="cx"> NetworkStorageSession(SessionID, std::unique_ptr<SoupNetworkSession>&&);
</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<String> m_topPrivatelyControlledDomainsForCookiePartitioning;
+#endif
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT String cookieStoragePartition(const ResourceRequest&);
</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& 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<String>& hosts, bool value)
+{
+ if (value)
+ m_topPrivatelyControlledDomainsForCookiePartitioning.add(hosts.begin(), hosts.end());
+ else {
+ for (auto& 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 <wilander@apple.com>
+
+ Resource Load Statistics: Communicate to the network process which domains to partition
+ https://bugs.webkit.org/show_bug.cgi?id=169322
+ <rdar://problem/30768921>
+
+ 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 <mcatanzaro@igalia.com>
</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<String>& domains, bool value)
+{
+ NetworkStorageSession::defaultStorageSession().setShouldPartitionCookiesForHosts(domains, value);
+}
+#endif
+
</ins><span class="cx"> static void fetchDiskCacheEntries(SessionID sessionID, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void (Vector<WebsiteData::Entry>)>&& 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<String>& filenames, Function<void ()>&& completionHandler);
</span><span class="cx">
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+ void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, 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<String> 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, "%llu Creating NetworkDataTask with URL %s", [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, "%llu Partitioning cookies for URL %s", [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)->getHTTPCookieAcceptPolicy(toGenericCallbackFunction<WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy>(context, callback));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WKCookieManagerSetCookieStoragePartitioningEnabled(WKCookieManagerRef cookieManager, bool enabled)
+{
+ toImpl(cookieManager)->setCookieStoragePartitioningEnabled(enabled);
+}
+
</ins><span class="cx"> void WKCookieManagerStartObservingCookieChanges(WKCookieManagerRef cookieManager)
</span><span class="cx"> {
</span><span class="cx"> toImpl(cookieManager)->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<String>& topPrivatelyOwnedDomains, bool value)
+{
+ connection()->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<String>& paths);
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+ void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
+#endif
</ins><span class="cx"> void logDiagnosticMessage(uint64_t pageID, const String& message, const String& description, WebCore::ShouldSample);
</span><span class="cx"> void logDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result, WebCore::ShouldSample);
</span><span class="cx"> void logDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& 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<String> paths)
</span><span class="cx">
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+ ShouldPartitionCookiesForTopPrivatelyOwnedDomains(Vector<String> 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 "APIArray.h"
</span><span class="cx"> #include "APISecurityOrigin.h"
</span><ins>+#include "NetworkProcessMessages.h"
</ins><span class="cx"> #include "WebCookieManagerMessages.h"
</span><span class="cx"> #include "WebCookieManagerProxyMessages.h"
</span><span class="cx"> #include "WebProcessPool.h"
</span><span class="lines">@@ -196,4 +197,13 @@
</span><span class="cx"> callback->performCallbackWithReturnValue(policy);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebCookieManagerProxy::setCookieStoragePartitioningEnabled(bool enabled)
+{
+#if PLATFORM(COCOA)
+ processPool()->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<void (HTTPCookieAcceptPolicy, CallbackBase::Error)>);
</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& 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& 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& resourceStatistic)
</span><span class="cx"> {
</span><span class="cx"> if (!resourceStatistic.isPrevalentResource
</span><del>- && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
</del><ins>+ && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic)) {
</ins><span class="cx"> resourceStatistic.isPrevalentResource = true;
</span><ins>+ if (!resourceStatistic.hadUserInteraction)
+ m_resourceLoadStatisticsStore->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<void(const Vector<String>& primaryDomain, bool value)>&& shouldPartitionCookiesForDomainsHandler)
+{
+ registerSharedResourceLoadObserver();
+ m_resourceLoadStatisticsStore->setShouldPartitionCookiesCallback([this, shouldPartitionCookiesForDomainsHandler = WTFMove(shouldPartitionCookiesForDomainsHandler)] (const Vector<String>& 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<void(const Vector<String>& primaryDomain, bool value)>&& shouldPartitionCookiesForDomainsHandler);
</ins><span class="cx">
</span><span class="cx"> void resourceLoadStatisticsUpdated(const Vector<WebCore::ResourceLoadStatistics>& 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<String>& topPrivatelyOwnedDomains, bool value)
+{
+ for (auto& processPool : processPools())
+ processPool->sendToNetworkingProcess(Messages::NetworkProcess::ShouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value));
+}
+#endif
+
</ins><span class="cx"> void WebsiteDataStore::webPageWasAdded(WebPageProxy& 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->registerSharedResourceLoadObserver(
+ [this] (const Vector<String>& topPrivatelyOwnedDomains, bool value) {
+ this->shouldPartitionCookiesForTopPrivatelyOwnedDomains(topPrivatelyOwnedDomains, value);
+ });
+#else
</ins><span class="cx"> m_resourceLoadStatistics->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<WebsiteDataType>, const Vector<WebsiteDataRecord>&, std::function<void ()> completionHandler);
</span><span class="cx"> void removeDataForTopPrivatelyOwnedDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyOwnedDomains, std::function<void(Vector<String>)> completionHandler);
</span><span class="cx">
</span><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
+ void shouldPartitionCookiesForTopPrivatelyOwnedDomains(const Vector<String>&, bool value);
+#endif
</ins><span class="cx"> void resolveDirectoriesIfNecessary();
</span><span class="cx"> const String& resolvedApplicationCacheDirectory() const { return m_resolvedConfiguration.applicationCacheDirectory; }
</span><span class="cx"> const String& 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 <wilander@apple.com>
+
+ Resource Load Statistics: Communicate to the network process which domains to partition
+ https://bugs.webkit.org/show_bug.cgi?id=169322
+ <rdar://problem/30768921>
+
+ 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 <sabouhallawa@apple.com>
</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<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetCookieStoragePartitioningEnabled"));
+
+ WKRetainPtr<WKBooleanRef> 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<WKRetainPtr<WKStringRef>> keys;
+ Vector<WKRetainPtr<WKTypeRef>> values;
+
+ keys.append({ AdoptWK, WKStringCreateWithUTF8CString("HostName") });
+ values.append({ AdoptWK, WKStringCreateWithJSString(hostName) });
+
+ keys.append({ AdoptWK, WKStringCreateWithUTF8CString("Value") });
+ values.append({ AdoptWK, WKBooleanCreate(value) });
+
+ Vector<WKStringRef> rawKeys(keys.size());
+ Vector<WKTypeRef> rawValues(values.size());
+
+ for (size_t i = 0; i < keys.size(); ++i) {
+ rawKeys[i] = keys[i].get();
+ rawValues[i] = values[i].get();
+ }
+
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsFireShouldPartitionCookiesHandler"));
+ WKRetainPtr<WKDictionaryRef> 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<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsNotifyPagesWhenDataRecordsWereScanned"));
</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, "SetCookieStoragePartitioningEnabled")) {
+ WKBooleanRef accept = static_cast<WKBooleanRef>(messageBody);
+ WKCookieManagerSetCookieStoragePartitioningEnabled(WKContextGetCookieManager(TestController::singleton().context()), WKBooleanGetValue(accept));
+ return nullptr;
+ }
+
</ins><span class="cx"> if (WKStringIsEqualToUTF8CString(messageName, "ImageCountInGeneralPasteboard")) {
</span><span class="cx"> unsigned count = TestController::singleton().imageCountInGeneralPasteboard();
</span><span class="cx"> WKRetainPtr<WKUInt64Ref> 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, "StatisticsFireShouldPartitionCookiesHandler")) {
+ ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
+
+ WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+ WKRetainPtr<WKStringRef> hostNameKey(AdoptWK, WKStringCreateWithUTF8CString("HostName"));
+ WKRetainPtr<WKStringRef> valueKey(AdoptWK, WKStringCreateWithUTF8CString("Value"));
+
+ WKStringRef hostName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, hostNameKey.get()));
+ WKBooleanRef value = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, valueKey.get()));
+
+ TestController::singleton().statisticsFireShouldPartitionCookiesHandler(hostName, WKBooleanGetValue(value));
+ return nullptr;
+ }
+
</ins><span class="cx"> if (WKStringIsEqualToUTF8CString(messageName, "StatisticsNotifyPagesWhenDataRecordsWereScanned")) {
</span><span class="cx"> ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
</span><span class="cx"> WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
</span></span></pre>
</div>
</div>
</body>
</html>