<!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>[162166] 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/162166">162166</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-01-16 16:33:35 -0800 (Thu, 16 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain
https://bugs.webkit.org/show_bug.cgi?id=127139

Reviewed by Brady Eidson.

Source/WebCore: 

* platform/ios/WebCoreSystemInterfaceIOS.mm:
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:
Pass first party URL down, because reading cookies depends on it when this policy
in in action.

* platform/network/cf/CookieJarCFNet.cpp:
(WebCore::copyCookiesForURLWithFirstPartyURL):
(WebCore::cookiesForDOM):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::cookiesEnabled):
(WebCore::getRawCookies):
Use a new CFNetwork API that takes first party URL.

* platform/network/mac/CookieJarMac.mm:
(WebCore::cookiesForDOM):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::cookiesEnabled):
(WebCore::getRawCookies):
(WebCore::deleteCookie):
Pass first party URL (and null in deleteCookie, as there is none).

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::platformLoadResourceSynchronously):
Removed a call to shouldRelaxThirdPartyCookiePolicy(), which no longer exists
in trunk.

Source/WebKit/mac: 

* WebView/WebPreferences.mm: (-[WebPreferences _synchronizeWebStoragePolicyWithCookiePolicy]):
Handle the new case.

Source/WebKit2: 

* Shared/HTTPCookieAcceptPolicy.h:
* UIProcess/API/C/WKAPICast.h:
(WebKit::toHTTPCookieAcceptPolicy):
(WebKit::toAPI):
* UIProcess/API/C/WKCookieManager.h:
Added the policy to appropriate switches and enums.

WebKitLibraries: 

* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLion.a:
* libWebKitSystemInterfaceMavericks.a:
* libWebKitSystemInterfaceMountainLion.a:
Update WebKitSystemInterface.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm">trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebCoreSystemInterfaceh">trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebCoreSystemInterfacemm">trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfCookieJarCFNetcpp">trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.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="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesmm">trunk/Source/WebKit/mac/WebView/WebPreferences.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedHTTPCookieAcceptPolicyh">trunk/Source/WebKit2/Shared/HTTPCookieAcceptPolicy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKAPICasth">trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKCookieManagerh">trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h</a></li>
<li><a href="#trunkWebKitLibrariesChangeLog">trunk/WebKitLibraries/ChangeLog</a></li>
<li><a href="#trunkWebKitLibrariesWebKitSystemInterfaceh">trunk/WebKitLibraries/WebKitSystemInterface.h</a></li>
<li><a href="#trunkWebKitLibrarieslibWebKitSystemInterfaceLiona">trunk/WebKitLibraries/libWebKitSystemInterfaceLion.a</a></li>
<li><a href="#trunkWebKitLibrarieslibWebKitSystemInterfaceMavericksa">trunk/WebKitLibraries/libWebKitSystemInterfaceMavericks.a</a></li>
<li><a href="#trunkWebKitLibrarieslibWebKitSystemInterfaceMountainLiona">trunk/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebCore/ChangeLog        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-01-16  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain
+        https://bugs.webkit.org/show_bug.cgi?id=127139
+
+        Reviewed by Brady Eidson.
+
+        * platform/ios/WebCoreSystemInterfaceIOS.mm:
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+        Pass first party URL down, because reading cookies depends on it when this policy
+        in in action.
+
+        * platform/network/cf/CookieJarCFNet.cpp:
+        (WebCore::copyCookiesForURLWithFirstPartyURL):
+        (WebCore::cookiesForDOM):
+        (WebCore::cookieRequestHeaderFieldValue):
+        (WebCore::cookiesEnabled):
+        (WebCore::getRawCookies):
+        Use a new CFNetwork API that takes first party URL.
+
+        * platform/network/mac/CookieJarMac.mm:
+        (WebCore::cookiesForDOM):
+        (WebCore::cookieRequestHeaderFieldValue):
+        (WebCore::cookiesEnabled):
+        (WebCore::getRawCookies):
+        (WebCore::deleteCookie):
+        Pass first party URL (and null in deleteCookie, as there is none).
+
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::platformLoadResourceSynchronously):
+        Removed a call to shouldRelaxThirdPartyCookiePolicy(), which no longer exists
+        in trunk.
+
</ins><span class="cx"> 2014-01-16  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the iOS build after r162150.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebCoreSystemInterfaceIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx"> unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
</span><span class="cx"> void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
</span><span class="cx"> NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef);
</span><del>-NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
</del><ins>+NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *);
</ins><span class="cx"> void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
</span><span class="cx"> void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef);
</span><span class="cx"> void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebCoreSystemInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx"> extern unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
</span><span class="cx"> extern void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
</span><span class="cx"> extern NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef);
</span><del>-extern NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
</del><ins>+extern NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *);
</ins><span class="cx"> extern void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
</span><span class="cx"> extern void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
</span><span class="cx"> extern void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebCoreSystemInterfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx"> unsigned (*wkGetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef);
</span><span class="cx"> void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned);
</span><span class="cx"> NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef);
</span><del>-NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *);
</del><ins>+NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *);
</ins><span class="cx"> void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
</span><span class="cx"> void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef);
</span><span class="cx"> void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfCookieJarCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -41,6 +41,10 @@
</span><span class="cx"> #include &lt;windows.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+enum {
+    CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain = 3;
+};
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static const CFStringRef s_setCookieKeyCF = CFSTR(&quot;Set-Cookie&quot;);
</span><span class="lines">@@ -93,6 +97,19 @@
</span><span class="cx">     return filteredCookies;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static RetainPtr&lt;CFArrayRef&gt; copyCookiesForURLWithFirstPartyURL(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url)
+{
+    bool secure = url.protocolIs(&quot;https&quot;);
+
+#if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 10100)
+    RetainPtr&lt;CFArrayRef&gt; cookiesCF = adoptCF(_CFHTTPCookieStorageCopyCookiesForURLWithMainDocumentURL(session.cookieStorage().get(), url.createCFURL().get(), firstParty.createCFURL().get(), secure));
+#else
+    // _CFHTTPCookieStorageCopyCookiesForURLWithMainDocumentURL is not available on other platforms.
+    UNUSED_PARAM(firstParty);
+    RetainPtr&lt;CFArrayRef&gt; cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), url.createCFURL().get(), secure));
+#endif
+}
+
</ins><span class="cx"> void setCookiesFromDOM(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url, const String&amp; value)
</span><span class="cx"> {
</span><span class="cx">     // &lt;rdar://problem/5632883&gt; CFHTTPCookieStorage stores an empty cookie, which would be sent as &quot;Cookie: =&quot;.
</span><span class="lines">@@ -117,22 +134,16 @@
</span><span class="cx">     CFHTTPCookieStorageSetCookies(session.cookieStorage().get(), filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String cookiesForDOM(const NetworkStorageSession&amp; session, const URL&amp;, const URL&amp; url)
</del><ins>+String cookiesForDOM(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url)
</ins><span class="cx"> {
</span><del>-    RetainPtr&lt;CFURLRef&gt; urlCF = url.createCFURL();
-
-    bool secure = url.protocolIs(&quot;https&quot;);
-    RetainPtr&lt;CFArrayRef&gt; cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
</del><ins>+    RetainPtr&lt;CFArrayRef&gt; cookiesCF = copyCookiesForURLWithFirstPartyURL(session, firstParty, url);
</ins><span class="cx">     RetainPtr&lt;CFDictionaryRef&gt; headerCF = adoptCF(CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, filterCookies(cookiesCF.get()).get()));
</span><span class="cx">     return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String cookieRequestHeaderFieldValue(const NetworkStorageSession&amp; session, const URL&amp; /*firstParty*/, const URL&amp; url)
</del><ins>+String cookieRequestHeaderFieldValue(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url)
</ins><span class="cx"> {
</span><del>-    RetainPtr&lt;CFURLRef&gt; urlCF = url.createCFURL();
-
-    bool secure = url.protocolIs(&quot;https&quot;);
-    RetainPtr&lt;CFArrayRef&gt; cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
</del><ins>+    RetainPtr&lt;CFArrayRef&gt; cookiesCF = copyCookiesForURLWithFirstPartyURL(session, firstParty, url);
</ins><span class="cx">     RetainPtr&lt;CFDictionaryRef&gt; headerCF = adoptCF(CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
</span><span class="cx">     return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
</span><span class="cx"> }
</span><span class="lines">@@ -140,18 +151,15 @@
</span><span class="cx"> bool cookiesEnabled(const NetworkStorageSession&amp; session, const URL&amp; /*firstParty*/, const URL&amp; /*url*/)
</span><span class="cx"> {
</span><span class="cx">     CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageGetCookieAcceptPolicy(session.cookieStorage().get());
</span><del>-    return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways;
</del><ins>+    return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool getRawCookies(const NetworkStorageSession&amp; session, const URL&amp; /*firstParty*/, const URL&amp; url, Vector&lt;Cookie&gt;&amp; rawCookies)
</del><ins>+bool getRawCookies(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url, Vector&lt;Cookie&gt;&amp; rawCookies)
</ins><span class="cx"> {
</span><span class="cx">     rawCookies.clear();
</span><span class="cx"> 
</span><del>-    RetainPtr&lt;CFURLRef&gt; urlCF = url.createCFURL();
</del><ins>+    RetainPtr&lt;CFArrayRef&gt; cookiesCF = copyCookiesForURLWithFirstPartyURL(session, firstParty, url);
</ins><span class="cx"> 
</span><del>-    bool sendSecureCookies = url.protocolIs(&quot;https&quot;);
-    RetainPtr&lt;CFArrayRef&gt; cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), sendSecureCookies));
-
</del><span class="cx">     CFIndex count = CFArrayGetCount(cookiesCF.get());
</span><span class="cx">     rawCookies.reserveCapacity(count);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacCookieJarMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -35,6 +35,10 @@
</span><span class="cx"> #import &quot;NetworkStorageSession.h&quot;
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> 
</span><ins>+enum {
+    NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3
+};
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static RetainPtr&lt;NSArray&gt; filterCookies(NSArray *unfilteredCookies)
</span><span class="lines">@@ -61,22 +65,22 @@
</span><span class="cx">     return filteredCookies;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String cookiesForDOM(const NetworkStorageSession&amp; session, const URL&amp;, const URL&amp; url)
</del><ins>+String cookiesForDOM(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url)
</ins><span class="cx"> {
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);
</del><ins>+    NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), firstParty, url);
</ins><span class="cx">     return [[NSHTTPCookie requestHeaderFieldsWithCookies:filterCookies(cookies).get()] objectForKey:@&quot;Cookie&quot;];
</span><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String cookieRequestHeaderFieldValue(const NetworkStorageSession&amp; session, const URL&amp; /*firstParty*/, const URL&amp; url)
</del><ins>+String cookieRequestHeaderFieldValue(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url)
</ins><span class="cx"> {
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);
</del><ins>+    NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), firstParty, url);
</ins><span class="cx">     return [[NSHTTPCookie requestHeaderFieldsWithCookies:cookies] objectForKey:@&quot;Cookie&quot;];
</span><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="lines">@@ -110,18 +114,18 @@
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><span class="cx">     NSHTTPCookieAcceptPolicy cookieAcceptPolicy = static_cast&lt;NSHTTPCookieAcceptPolicy&gt;(wkGetHTTPCookieAcceptPolicy(session.cookieStorage().get()));
</span><del>-    return cookieAcceptPolicy == NSHTTPCookieAcceptPolicyAlways || cookieAcceptPolicy == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
</del><ins>+    return cookieAcceptPolicy == NSHTTPCookieAcceptPolicyAlways || cookieAcceptPolicy == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain || cookieAcceptPolicy == NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
</ins><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool getRawCookies(const NetworkStorageSession&amp; session, const URL&amp; /*firstParty*/, const URL&amp; url, Vector&lt;Cookie&gt;&amp; rawCookies)
</del><ins>+bool getRawCookies(const NetworkStorageSession&amp; session, const URL&amp; firstParty, const URL&amp; url, Vector&lt;Cookie&gt;&amp; rawCookies)
</ins><span class="cx"> {
</span><span class="cx">     rawCookies.clear();
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);
</del><ins>+    NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), firstParty, url);
</ins><span class="cx">     NSUInteger count = [cookies count];
</span><span class="cx">     rawCookies.reserveCapacity(count);
</span><span class="cx">     for (NSUInteger i = 0; i &lt; count; ++i) {
</span><span class="lines">@@ -139,9 +143,8 @@
</span><span class="cx"> {
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    NSURL *cookieURL = url;
</del><span class="cx">     RetainPtr&lt;CFHTTPCookieStorageRef&gt; cookieStorage = session.cookieStorage();
</span><del>-    NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), cookieURL);
</del><ins>+    NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), 0, url);
</ins><span class="cx"> 
</span><span class="cx">     NSString *cookieNameString = cookieName;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -386,7 +386,6 @@
</span><span class="cx">     handle-&gt;createNSURLConnection(
</span><span class="cx">         handle-&gt;delegate(), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.
</span><span class="cx">         storedCredentials == AllowStoredCredentials,
</span><del>-        shouldRelaxThirdPartyCookiePolicy(context, request.url()),
</del><span class="cx">         handle-&gt;shouldContentSniff() || (context &amp;&amp; context-&gt;localFileContentSniffingEnabled()),
</span><span class="cx">         SchedulingBehavior::Synchronous,
</span><span class="cx">         (NSDictionary *)handle-&gt;client()-&gt;connectionProperties(handle.get()));
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-01-16  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain
+        https://bugs.webkit.org/show_bug.cgi?id=127139
+
+        Reviewed by Brady Eidson.
+
+        * WebView/WebPreferences.mm: (-[WebPreferences _synchronizeWebStoragePolicyWithCookiePolicy]):
+        Handle the new case.
+
</ins><span class="cx"> 2014-01-16  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Fix UIKit build warning about undefined macro ENABLE_NETSCAPE_PLUGIN_API
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -49,6 +49,10 @@
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #import &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><ins>+enum {
+    NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3
+};
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -2312,6 +2316,8 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_synchronizeWebStoragePolicyWithCookiePolicy
</span><span class="cx"> {
</span><ins>+    // FIXME: This should be done in clients, WebKit shouldn't be making such policy decisions.
+
</ins><span class="cx">     NSHTTPCookieAcceptPolicy cookieAcceptPolicy = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
</span><span class="cx">     WebStorageBlockingPolicy storageBlockingPolicy;
</span><span class="cx">     switch (cookieAcceptPolicy) {
</span><span class="lines">@@ -2319,6 +2325,7 @@
</span><span class="cx">         storageBlockingPolicy = WebAllowAllStorage;
</span><span class="cx">         break;
</span><span class="cx">     case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
</span><ins>+    case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
</ins><span class="cx">         storageBlockingPolicy = WebBlockThirdPartyStorage;
</span><span class="cx">         break;
</span><span class="cx">     case NSHTTPCookieAcceptPolicyNever:
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-01-16  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain
+        https://bugs.webkit.org/show_bug.cgi?id=127139
+
+        Reviewed by Brady Eidson.
+
+        * Shared/HTTPCookieAcceptPolicy.h:
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toHTTPCookieAcceptPolicy):
+        (WebKit::toAPI):
+        * UIProcess/API/C/WKCookieManager.h:
+        Added the policy to appropriate switches and enums.
+
</ins><span class="cx"> 2014-01-16  Jeffrey Pfau  &lt;jpfau@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix build after r162161. One FINAL was still present.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedHTTPCookieAcceptPolicyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/HTTPCookieAcceptPolicy.h (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/HTTPCookieAcceptPolicy.h        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebKit2/Shared/HTTPCookieAcceptPolicy.h        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">     HTTPCookieAcceptPolicyAlways = 0,
</span><span class="cx">     HTTPCookieAcceptPolicyNever = 1,
</span><span class="cx">     HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2,
</span><ins>+    HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3,
</ins><span class="cx"> };
</span><span class="cx"> typedef unsigned HTTPCookieAcceptPolicy;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKAPICasth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -392,6 +392,8 @@
</span><span class="cx">         return HTTPCookieAcceptPolicyNever;
</span><span class="cx">     case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
</span><span class="cx">         return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
</span><ins>+    case kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
+        return HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="lines">@@ -407,6 +409,8 @@
</span><span class="cx">         return kWKHTTPCookieAcceptPolicyNever;
</span><span class="cx">     case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
</span><span class="cx">         return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
</span><ins>+    case HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
+        return kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKCookieManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -35,7 +35,8 @@
</span><span class="cx"> enum {
</span><span class="cx">     kWKHTTPCookieAcceptPolicyAlways = 0,
</span><span class="cx">     kWKHTTPCookieAcceptPolicyNever = 1,
</span><del>-    kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2
</del><ins>+    kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2,
+    kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3
</ins><span class="cx"> };
</span><span class="cx"> typedef uint32_t WKHTTPCookieAcceptPolicy;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebKitLibrariesChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/ChangeLog (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/ChangeLog        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/WebKitLibraries/ChangeLog        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-01-16  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain
+        https://bugs.webkit.org/show_bug.cgi?id=127139
+
+        Reviewed by Brady Eidson.
+
+        * WebKitSystemInterface.h:
+        * libWebKitSystemInterfaceLion.a:
+        * libWebKitSystemInterfaceMavericks.a:
+        * libWebKitSystemInterfaceMountainLion.a:
+        Update WebKitSystemInterface.
+
</ins><span class="cx"> 2014-01-16  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Subpixel layout: Enable subpixel layout for Apple Windows.
</span></span></pre></div>
<a id="trunkWebKitLibrariesWebKitSystemInterfaceh"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/WebKitSystemInterface.h (162165 => 162166)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/WebKitSystemInterface.h        2014-01-17 00:22:47 UTC (rev 162165)
+++ trunk/WebKitLibraries/WebKitSystemInterface.h        2014-01-17 00:33:35 UTC (rev 162166)
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx"> 
</span><span class="cx"> CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*);
</span><span class="cx"> 
</span><del>-#if MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</del><ins>+#if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</ins><span class="cx"> enum {
</span><span class="cx">     WKCTFontTransformApplyShaping = (1 &lt;&lt; 0),
</span><span class="cx">     WKCTFontTransformApplyPositioning = (1 &lt;&lt; 1)
</span><span class="lines">@@ -181,13 +181,13 @@
</span><span class="cx"> typedef int WKCTFontTransformOptions;
</span><span class="cx"> 
</span><span class="cx"> bool WKCTFontTransformGlyphs(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, WKCTFontTransformOptions options);
</span><del>-#endif
</del><ins>+#endif // TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</ins><span class="cx"> 
</span><span class="cx"> CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options);
</span><span class="cx"> 
</span><span class="cx"> CGSize WKCTRunGetInitialAdvance(CTRunRef);
</span><span class="cx"> 
</span><del>-#if !TARGET_IPHONE_SIMULATOR
</del><ins>+#if (TARGET_OS_IPHONE &amp;&amp; TARGET_OS_EMBEDDED) || MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1070
</ins><span class="cx"> CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef);
</span><span class="cx"> CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context);
</span><span class="cx"> #endif
</span><span class="lines">@@ -275,7 +275,7 @@
</span><span class="cx"> unsigned WKGetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef);
</span><span class="cx"> void WKSetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef, unsigned policy);
</span><span class="cx"> NSArray *WKHTTPCookies(CFHTTPCookieStorageRef);
</span><del>-NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *);
</del><ins>+NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *, NSURL *);
</ins><span class="cx"> void WKSetHTTPCookiesForURL(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *);
</span><span class="cx"> void WKDeleteAllHTTPCookies(CFHTTPCookieStorageRef);
</span><span class="cx"> void WKDeleteHTTPCookie(CFHTTPCookieStorageRef, NSHTTPCookie *);
</span><span class="lines">@@ -535,7 +535,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WKCFNetworkSetOverrideSystemProxySettings(CFDictionaryRef);
</span><span class="cx"> 
</span><del>-#if MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1080
</del><ins>+#if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1080
</ins><span class="cx"> bool WKIsPublicSuffix(NSString *domain);
</span><span class="cx"> 
</span><span class="cx"> CFArrayRef WKCFURLCacheCopyAllHostNamesInPersistentStoreForPartition(CFStringRef partition);
</span></span></pre></div>
<a id="trunkWebKitLibrarieslibWebKitSystemInterfaceLiona"></a>
<div class="binary"><h4>Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceLion.a</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkWebKitLibrarieslibWebKitSystemInterfaceMavericksa"></a>
<div class="binary"><h4>Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceMavericks.a</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkWebKitLibrarieslibWebKitSystemInterfaceMountainLiona"></a>
<div class="binary"><h4>Modified: trunk/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
</div>

</body>
</html>