<!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>[214270] 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/214270">214270</a></dd>
<dt>Author</dt> <dd>wilander@apple.com</dd>
<dt>Date</dt> <dd>2017-03-22 12:43:25 -0700 (Wed, 22 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Resource Load Statistics: Fix partitioning bug for client-side cookie access
https://bugs.webkit.org/show_bug.cgi?id=169906
&lt;rdar://problem/31164456&gt;

Reviewed by Alex Christensen.

Source/WebCore:

The existing test case was expanded to cover this change.

* platform/network/NetworkStorageSession.h:
    Moved the two cookieStoragePartition() functions into the class.
    Also declared them const.
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::cookieStoragePartition):
    Now checks whether it should partition or not.
(WebCore::getPartitioningDomain):
    Inline convenience function.
(WebCore::NetworkStorageSession::shouldPartitionCookies):
    Renamed since it now receives a top privately controlled domain
    instead of a host.
(WebCore::cookieStoragePartition): Deleted.
    This moved into NetworkStorageSession.
(WebCore::hostIsInDomain): Deleted.
    No longer needed since we generate the top privately controlled
    domain for both the resource and the partition.
(WebCore::NetworkStorageSession::shouldPartitionCookiesForHost): Deleted.
    Renamed WebCore::NetworkStorageSession::shouldPartitionCookies().
* platform/network/mac/CookieJarMac.mm:
(WebCore::cookiesInPartitionForURL):
    Now calls WebCore::NetworkStorageSession::cookieStoragePartition().
(WebCore::setCookiesFromDOM):
    Now calls WebCore::NetworkStorageSession::cookieStoragePartition().
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection):
    Now calls WebCore::NetworkStorageSession::cookieStoragePartition().

Source/WebKit2:

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
    This function no longer asks the NetworkStorageSession
    whether it should partition or not. That decision is
    now made as part of
    WebCore::NetworkStorageSession::cookieStoragePartition().
    The empty partition signals no partitioning.

LayoutTests:

* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt:
* http/tests/loading/resourceLoadStatistics/resources/get-cookies.php:
    Now also outputs document.cookie client-side.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestsloadingresourceLoadStatisticspartitionedcookieswithandwithoutuserinteractionexpectedtxt">trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsloadingresourceLoadStatisticsresourcesgetcookiesphp">trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCoreplatformnetworkmacCookieJarMacmm">trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm">trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscocoaNetworkDataTaskCocoamm">trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/LayoutTests/ChangeLog        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-03-22  John Wilander  &lt;wilander@apple.com&gt;
+
+        Resource Load Statistics: Fix partitioning bug for client-side cookie access
+        https://bugs.webkit.org/show_bug.cgi?id=169906
+        &lt;rdar://problem/31164456&gt;
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt:
+        * http/tests/loading/resourceLoadStatistics/resources/get-cookies.php:
+            Now also outputs document.cookie client-side.
+
</ins><span class="cx"> 2017-03-22  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Media files served without an extension will not load in &lt;video&gt; tag.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsloadingresourceLoadStatisticspartitionedcookieswithandwithoutuserinteractionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -50,8 +50,8 @@
</span><span class="cx"> Should receive no cookies.
</span><span class="cx"> Did not receive cookie named 'firstPartyCookie'.
</span><span class="cx"> Did not receive cookie named 'thirdPartyCookie'.
</span><ins>+Client-side document.cookie:
</ins><span class="cx"> 
</span><del>-
</del><span class="cx"> --------
</span><span class="cx"> Frame: '&lt;!--framePath //&lt;!--frame1--&gt;--&gt;'
</span><span class="cx"> --------
</span><span class="lines">@@ -64,8 +64,8 @@
</span><span class="cx"> Should only receive partitioned, third party cookie.
</span><span class="cx"> Did not receive cookie named 'firstPartyCookie'.
</span><span class="cx"> Received cookie named 'thirdPartyCookie'.
</span><ins>+Client-side document.cookie: thirdPartyCookie=value
</ins><span class="cx"> 
</span><del>-
</del><span class="cx"> --------
</span><span class="cx"> Frame: '&lt;!--framePath //&lt;!--frame3--&gt;--&gt;'
</span><span class="cx"> --------
</span><span class="lines">@@ -72,4 +72,4 @@
</span><span class="cx"> After user interaction, should only receive non-partitioned, first party cookie.
</span><span class="cx"> Received cookie named 'firstPartyCookie'.
</span><span class="cx"> Did not receive cookie named 'thirdPartyCookie'.
</span><del>-
</del><ins>+Client-side document.cookie: firstPartyCookie=value
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsloadingresourceLoadStatisticsresourcesgetcookiesphp"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/LayoutTests/http/tests/loading/resourceLoadStatistics/resources/get-cookies.php        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -11,3 +11,7 @@
</span><span class="cx">     echo &quot;Received cookie named '&quot; . $_GET[&quot;name2&quot;] . &quot;'.&lt;br&gt;&quot;;
</span><span class="cx"> }
</span><span class="cx"> ?&gt;
</span><ins>+&lt;p id=&quot;output&quot;&gt;&lt;/p&gt;
+&lt;script&gt;
+    document.getElementById(&quot;output&quot;).textContent = &quot;Client-side document.cookie: &quot; + document.cookie;
+&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 (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/Source/WebCore/ChangeLog        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2017-03-22  John Wilander  &lt;wilander@apple.com&gt;
+
+        Resource Load Statistics: Fix partitioning bug for client-side cookie access
+        https://bugs.webkit.org/show_bug.cgi?id=169906
+        &lt;rdar://problem/31164456&gt;
+
+        Reviewed by Alex Christensen.
+
+        The existing test case was expanded to cover this change.
+
+        * platform/network/NetworkStorageSession.h:
+            Moved the two cookieStoragePartition() functions into the class.
+            Also declared them const.
+        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+        (WebCore::NetworkStorageSession::cookieStoragePartition):
+            Now checks whether it should partition or not.
+        (WebCore::getPartitioningDomain):
+            Inline convenience function.
+        (WebCore::NetworkStorageSession::shouldPartitionCookies):
+            Renamed since it now receives a top privately controlled domain
+            instead of a host.
+        (WebCore::cookieStoragePartition): Deleted.
+            This moved into NetworkStorageSession.
+        (WebCore::hostIsInDomain): Deleted.
+            No longer needed since we generate the top privately controlled
+            domain for both the resource and the partition.
+        (WebCore::NetworkStorageSession::shouldPartitionCookiesForHost): Deleted.
+            Renamed WebCore::NetworkStorageSession::shouldPartitionCookies().
+        * platform/network/mac/CookieJarMac.mm:
+        (WebCore::cookiesInPartitionForURL):
+            Now calls WebCore::NetworkStorageSession::cookieStoragePartition().
+        (WebCore::setCookiesFromDOM):
+            Now calls WebCore::NetworkStorageSession::cookieStoragePartition().
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::createNSURLConnection):
+            Now calls WebCore::NetworkStorageSession::cookieStoragePartition().
+
</ins><span class="cx"> 2017-03-22  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Media files served without an extension will not load in &lt;video&gt; tag.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -79,7 +79,8 @@
</span><span class="cx">     WEBCORE_EXPORT RetainPtr&lt;CFHTTPCookieStorageRef&gt; cookieStorage() const;
</span><span class="cx">     WEBCORE_EXPORT static void setCookieStoragePartitioningEnabled(bool);
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    WEBCORE_EXPORT bool shouldPartitionCookiesForHost(const String&amp;);
</del><ins>+    WEBCORE_EXPORT String cookieStoragePartition(const ResourceRequest&amp;) const;
+    String cookieStoragePartition(const URL&amp; firstPartyForCookies, const URL&amp; resource) const;
</ins><span class="cx">     WEBCORE_EXPORT void setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd);
</span><span class="cx"> #endif
</span><span class="cx"> #elif USE(SOUP)
</span><span class="lines">@@ -130,11 +131,9 @@
</span><span class="cx">     CredentialStorage m_credentialStorage;
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><ins>+    bool shouldPartitionCookies(const String&amp; topPrivatelyControlledDomain) const;
</ins><span class="cx">     HashSet&lt;String&gt; m_topPrivatelyControlledDomainsForCookiePartitioning;
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-WEBCORE_EXPORT String cookieStoragePartition(const ResourceRequest&amp;);
-String cookieStoragePartition(const URL&amp; firstPartyForCookies, const URL&amp; resource);
-
</del><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfNetworkStorageSessionCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -108,50 +108,47 @@
</span><span class="cx">     cookieStoragePartitioningEnabled = enabled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if PLATFORM(COCOA)
</del><ins>+#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</ins><span class="cx"> 
</span><del>-String cookieStoragePartition(const ResourceRequest&amp; request)
</del><ins>+String NetworkStorageSession::cookieStoragePartition(const ResourceRequest&amp; request) const
</ins><span class="cx"> {
</span><span class="cx">     return cookieStoragePartition(request.firstPartyForCookies(), request.url());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool hostIsInDomain(StringView host, StringView domain)
</del><ins>+static inline String getPartitioningDomain(const URL&amp; url) 
</ins><span class="cx"> {
</span><del>-    if (!host.endsWithIgnoringASCIICase(domain))
-        return false;
-
-    ASSERT(host.length() &gt;= domain.length());
-    unsigned suffixOffset = host.length() - domain.length();
-    return suffixOffset == 0 || host[suffixOffset - 1] == '.';
</del><ins>+#if ENABLE(PUBLIC_SUFFIX_LIST)
+    auto domain = topPrivatelyControlledDomain(url.host());
+    if (domain.isEmpty())
+        domain = url.host();
+#else
+    auto domain = url.host();
+#endif
+    return domain;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String cookieStoragePartition(const URL&amp; firstPartyForCookies, const URL&amp; resource)
</del><ins>+String NetworkStorageSession::cookieStoragePartition(const URL&amp; firstPartyForCookies, const URL&amp; resource) const
</ins><span class="cx"> {
</span><span class="cx">     if (!cookieStoragePartitioningEnabled)
</span><span class="cx">         return emptyString();
</span><del>-
-    String firstPartyDomain = firstPartyForCookies.host();
-#if ENABLE(PUBLIC_SUFFIX_LIST)
-    firstPartyDomain = topPrivatelyControlledDomain(firstPartyDomain);
-#endif
</del><span class="cx">     
</span><del>-    return hostIsInDomain(resource.host(), firstPartyDomain) ? emptyString() : firstPartyDomain;
-}
</del><ins>+    auto resourceDomain = getPartitioningDomain(resource);
+    if (!shouldPartitionCookies(resourceDomain))
+        return emptyString();
</ins><span class="cx"> 
</span><del>-#endif
</del><ins>+    auto firstPartyDomain = getPartitioningDomain(firstPartyForCookies);
+    if (firstPartyDomain == resourceDomain)
+        return emptyString();
</ins><span class="cx"> 
</span><del>-#if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</del><ins>+    return firstPartyDomain;
+}
</ins><span class="cx"> 
</span><del>-bool NetworkStorageSession::shouldPartitionCookiesForHost(const String&amp; host)
</del><ins>+bool NetworkStorageSession::shouldPartitionCookies(const String&amp; topPrivatelyControlledDomain) const
</ins><span class="cx"> {
</span><del>-    if (host.isEmpty())
</del><ins>+    if (topPrivatelyControlledDomain.isEmpty())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    auto domain = topPrivatelyControlledDomain(host);
-    if (domain.isEmpty())
-        domain = host;
-
-    return m_topPrivatelyControlledDomainsForCookiePartitioning.contains(domain);
</del><ins>+    return m_topPrivatelyControlledDomainsForCookiePartitioning.contains(topPrivatelyControlledDomain);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkStorageSession::setShouldPartitionCookiesForHosts(const Vector&lt;String&gt;&amp; domainsToRemove, const Vector&lt;String&gt;&amp; domainsToAdd)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacCookieJarMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> 
</span><span class="cx"> static NSArray *cookiesInPartitionForURL(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url)
</span><span class="cx"> {
</span><del>-    String partition = cookieStoragePartition(firstParty, url);
</del><ins>+    String partition = session.cookieStoragePartition(firstParty, url);
</ins><span class="cx">     if (partition.isEmpty())
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx">     ASSERT([filteredCookies.get() count] &lt;= 1);
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    String partition = cookieStoragePartition(firstParty, url);
</del><ins>+    String partition = session.cookieStoragePartition(firstParty, url);
</ins><span class="cx">     if (!partition.isEmpty())
</span><span class="cx">         filteredCookies = applyPartitionToCookies(partition, filteredCookies.get());
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
</span><del>-    String storagePartition = cookieStoragePartition(firstRequest());
</del><ins>+    String storagePartition = d-&gt;m_context-&gt;storageSession().cookieStoragePartition(firstRequest());
</ins><span class="cx">     if (!storagePartition.isEmpty()) {
</span><span class="cx">         NSMutableURLRequest *mutableRequest = [[nsRequest mutableCopy] autorelease];
</span><span class="cx">         [mutableRequest _setProperty:storagePartition forKey:@&quot;__STORAGE_PARTITION_IDENTIFIER&quot;];
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-03-22  John Wilander  &lt;wilander@apple.com&gt;
+
+        Resource Load Statistics: Fix partitioning bug for client-side cookie access
+        https://bugs.webkit.org/show_bug.cgi?id=169906
+        &lt;rdar://problem/31164456&gt;
+
+        Reviewed by Alex Christensen.
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+            This function no longer asks the NetworkStorageSession
+            whether it should partition or not. That decision is
+            now made as part of
+            WebCore::NetworkStorageSession::cookieStoragePartition().
+            The empty partition signals no partitioning.
+
</ins><span class="cx"> 2017-03-22  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [QuickLook] Rename QuickLookHandle to PreviewLoader
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscocoaNetworkDataTaskCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (214269 => 214270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm        2017-03-22 19:32:38 UTC (rev 214269)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm        2017-03-22 19:43:25 UTC (rev 214270)
</span><span class="lines">@@ -123,11 +123,10 @@
</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>-    if (session.networkStorageSession().shouldPartitionCookiesForHost(url.host())) {
</del><ins>+    String storagePartition = session.networkStorageSession().cookieStoragePartition(request);
+    if (!storagePartition.isEmpty()) {
</ins><span class="cx">         LOG(NetworkSession, &quot;%llu Partitioning cookies for URL %s&quot;, [m_task taskIdentifier], nsRequest.URL.absoluteString.UTF8String);
</span><del>-        String storagePartition = WebCore::cookieStoragePartition(request);
-        if (!storagePartition.isEmpty())
-            m_task.get()._storagePartitionIdentifier = storagePartition;
</del><ins>+        m_task.get()._storagePartitionIdentifier = storagePartition;
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>