<!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>[160467] trunk/Source/WebCore</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/160467">160467</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-11 17:56:25 -0800 (Wed, 11 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add the CFNetwork implementation of the asynchronous ResourceHandle
https://bugs.webkit.org/show_bug.cgi?id=124440
Patch by Benjamin Poulain <bpoulain@apple.com> on 2013-12-11
Reviewed by Alexey Proskuryakov.
Add a second subclass of ResourceHandleCFURLConnectionDelegate: ResourceHandleCFURLConnectionDelegateWithOperationQueue.
The difference is those objects handle the network callback on a different queue.
Some common code has been refactored in ResourceHandleCFURLConnectionDelegate to reduce duplicated code.
The initialization of the request and connection is moved to the subclass to clean up initialization.
* WebCore.xcodeproj/project.pbxproj:
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleClient.cpp:
(WebCore::ResourceHandleClient::willCacheResponseAsync):
* platform/network/ResourceHandleClient.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: Added.
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::~ResourceHandleCFURLConnectionDelegateWithOperationQueue):
(WebCore::connectionWasCancelled):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupConnectionScheduling):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueShouldUseCredentialStorage):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace):
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: Copied from Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h.
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandleInternal::~ResourceHandleInternal):
(WebCore::ResourceHandle::createCFURLConnection):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::shouldUseCredentialStorage):
(WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
(WebCore::ResourceHandle::continueWillSendRequest):
(WebCore::ResourceHandle::continueDidReceiveResponse):
(WebCore::ResourceHandle::continueShouldUseCredentialStorage):
(WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
(WebCore::ResourceHandle::continueWillCacheResponse):
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegate::releaseHandle):
(WebCore::ResourceHandleCFURLConnectionDelegate::synthesizeRedirectResponseIfNecessary):
(WebCore::ResourceHandleCFURLConnectionDelegate::createResourceRequest):
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willSendRequest):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueWillSendRequest):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueDidReceiveResponse):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueShouldUseCredentialStorage):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueWillCacheResponse):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueCanAuthenticateAgainstProtectionSpace):
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandlecpp">trunk/Source/WebCore/platform/network/ResourceHandle.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleh">trunk/Source/WebCore/platform/network/ResourceHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleClientcpp">trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceHandleClienth">trunk/Source/WebCore/platform/network/ResourceHandleClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegatecpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateh">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegatecpp">trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegateh">trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueuecpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueueh">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/ChangeLog        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -1,3 +1,72 @@
</span><ins>+2013-12-11 Benjamin Poulain <bpoulain@apple.com>
+
+ Add the CFNetwork implementation of the asynchronous ResourceHandle
+ https://bugs.webkit.org/show_bug.cgi?id=124440
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add a second subclass of ResourceHandleCFURLConnectionDelegate: ResourceHandleCFURLConnectionDelegateWithOperationQueue.
+ The difference is those objects handle the network callback on a different queue.
+
+ Some common code has been refactored in ResourceHandleCFURLConnectionDelegate to reduce duplicated code.
+
+ The initialization of the request and connection is moved to the subclass to clean up initialization.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/network/ResourceHandle.h:
+ * platform/network/ResourceHandleClient.cpp:
+ (WebCore::ResourceHandleClient::willCacheResponseAsync):
+ * platform/network/ResourceHandleClient.h:
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: Added.
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::~ResourceHandleCFURLConnectionDelegateWithOperationQueue):
+ (WebCore::connectionWasCancelled):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupConnectionScheduling):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueShouldUseCredentialStorage):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse):
+ (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace):
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: Copied from Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h.
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
+ (WebCore::ResourceHandle::createCFURLConnection):
+ (WebCore::ResourceHandle::start):
+ (WebCore::ResourceHandle::shouldUseCredentialStorage):
+ (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
+ (WebCore::ResourceHandle::continueWillSendRequest):
+ (WebCore::ResourceHandle::continueDidReceiveResponse):
+ (WebCore::ResourceHandle::continueShouldUseCredentialStorage):
+ (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
+ (WebCore::ResourceHandle::continueWillCacheResponse):
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
+ (WebCore::ResourceHandleCFURLConnectionDelegate::releaseHandle):
+ (WebCore::ResourceHandleCFURLConnectionDelegate::synthesizeRedirectResponseIfNecessary):
+ (WebCore::ResourceHandleCFURLConnectionDelegate::createResourceRequest):
+ * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
+ * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willSendRequest):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueWillSendRequest):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueDidReceiveResponse):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueShouldUseCredentialStorage):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueWillCacheResponse):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::continueCanAuthenticateAgainstProtectionSpace):
+ * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
+
</ins><span class="cx"> 2013-12-11 David Kilzer <ddkilzer@apple.com>
</span><span class="cx">
</span><span class="cx"> Define m_hasBadParent in InlineBox if defined(ADDRESS_SANITIZER)
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/WebCore.exp.in        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -2274,6 +2274,7 @@
</span><span class="cx"> __ZN7WebCore19ResourceRequestBase14setCachePolicyENS_26ResourceRequestCachePolicyE
</span><span class="cx"> __ZN7WebCore19applicationIsWebAppEv
</span><span class="cx"> __ZN7WebCore20NetworkStateNotifier11setIsOnLineEb
</span><ins>+__ZN7WebCore20ResourceHandleClient22willCacheResponseAsyncEPNS_14ResourceHandleEPK20_CFCachedURLResponse
</ins><span class="cx"> __ZN7WebCore20applicationIsOkCupidEv
</span><span class="cx"> __ZN7WebCore20endOfEditableContentERKNS_15VisiblePositionE
</span><span class="cx"> __ZN7WebCore20lastOffsetForEditingEPKNS_4NodeE
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -910,6 +910,8 @@
</span><span class="cx">                 2655413A1489811C000DFC5D /* KeyEventIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 265541381489811C000DFC5D /* KeyEventIOS.mm */; };
</span><span class="cx">                 265541521489B233000DFC5D /* CursorIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2655414B1489AA2B000DFC5D /* CursorIOS.cpp */; };
</span><span class="cx">                 269239961505E1AA009E57FC /* JSIDBVersionChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 269239921505E1AA009E57FC /* JSIDBVersionChangeEvent.h */; };
</span><ins>+                26C15CF61857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C15CF41857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp */; };
+                26C15CF71857E15E00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C15CF51857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.h */; };
</ins><span class="cx">                 26C17A3E1491D2D400D12BA2 /* FileSystemIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C17A3C1491D2D400D12BA2 /* FileSystemIOS.h */; };
</span><span class="cx">                 26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */; };
</span><span class="cx">                 26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; };
</span><span class="lines">@@ -7554,6 +7556,8 @@
</span><span class="cx">                 2655414B1489AA2B000DFC5D /* CursorIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CursorIOS.cpp; path = ios/CursorIOS.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 269239911505E1AA009E57FC /* JSIDBVersionChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBVersionChangeEvent.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 269239921505E1AA009E57FC /* JSIDBVersionChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBVersionChangeEvent.h; sourceTree = "<group>"; };
</span><ins>+                26C15CF41857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp; sourceTree = "<group>"; };
+                26C15CF51857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleCFURLConnectionDelegateWithOperationQueue.h; sourceTree = "<group>"; };
</ins><span class="cx">                 26C17A3C1491D2D400D12BA2 /* FileSystemIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileSystemIOS.h; path = ios/FileSystemIOS.h; sourceTree = "<group>"; };
</span><span class="cx">                 26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FileSystemIOS.mm; path = ios/FileSystemIOS.mm; sourceTree = "<group>"; };
</span><span class="cx">                 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -19530,6 +19534,8 @@
</span><span class="cx">                                 7EE6845912D26E3800E79415 /* ResourceHandleCFNet.cpp */,
</span><span class="cx">                                 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */,
</span><span class="cx">                                 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */,
</span><ins>+                                26C15CF41857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp */,
+                                26C15CF51857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.h */,
</ins><span class="cx">                                 7EE6845A12D26E3800E79415 /* ResourceRequest.h */,
</span><span class="cx">                                 7EE6845B12D26E3800E79415 /* ResourceRequestCFNet.cpp */,
</span><span class="cx">                                 7EE6845C12D26E3800E79415 /* ResourceRequestCFNet.h */,
</span><span class="lines">@@ -22148,6 +22154,7 @@
</span><span class="cx">                                 49B3760D15C6C6840059131D /* ArrayValue.h in Headers */,
</span><span class="cx">                                 FD5686CA13AC180200B69C68 /* AsyncAudioDecoder.h in Headers */,
</span><span class="cx">                                 E1CDE9221501916900862CC5 /* AsyncFileStream.h in Headers */,
</span><ins>+                                26C15CF71857E15E00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.h in Headers */,
</ins><span class="cx">                                 7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */,
</span><span class="cx">                                 37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */,
</span><span class="cx">                                 E1FF8F601807442100132674 /* SubtleCrypto.h in Headers */,
</span><span class="lines">@@ -25719,6 +25726,7 @@
</span><span class="cx">                                 49B3760C15C6C6840059131D /* ArrayValue.cpp in Sources */,
</span><span class="cx">                                 FD5686C913AC180200B69C68 /* AsyncAudioDecoder.cpp in Sources */,
</span><span class="cx">                                 E1CDE92015018ED000862CC5 /* AsyncFileStream.cpp in Sources */,
</span><ins>+                                26C15CF61857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp in Sources */,
</ins><span class="cx">                                 A8C4A80E09D563270003AC8D /* Attr.cpp in Sources */,
</span><span class="cx">                                 FD629EA4154B47160006D026 /* AudioBasicInspectorNode.cpp in Sources */,
</span><span class="cx">                                 FD315FF612B0267600C1A359 /* AudioBasicProcessorNode.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.cpp (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.cpp        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.cpp        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx"> d->m_client = client;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if !PLATFORM(MAC)
</del><ins>+#if !PLATFORM(MAC) && !USE(CFNETWORK)
</ins><span class="cx"> // ResourceHandle never uses async client calls on these platforms yet.
</span><span class="cx"> void ResourceHandle::continueWillSendRequest(const ResourceRequest&)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandle.h        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if USE(CFNETWORK)
</span><ins>+typedef const struct _CFCachedURLResponse* CFCachedURLResponseRef;
</ins><span class="cx"> typedef struct _CFURLConnection* CFURLConnectionRef;
</span><span class="cx"> typedef int CFHTTPCookieStorageAcceptPolicy;
</span><span class="cx"> typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
</span><span class="lines">@@ -213,8 +214,10 @@
</span><span class="cx"> void continueCanAuthenticateAgainstProtectionSpace(bool);
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if PLATFORM(MAC)
</del><span class="cx"> // Called in response to ResourceHandleClient::willCacheResponseAsync().
</span><ins>+#if USE(CFNETWORK)
+ void continueWillCacheResponse(CFCachedURLResponseRef);
+#elif PLATFORM(MAC)
</ins><span class="cx"> void continueWillCacheResponse(NSCachedURLResponse *);
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -61,7 +61,12 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if PLATFORM(MAC)
</del><ins>+#if USE(CFNETWORK)
+void ResourceHandleClient::willCacheResponseAsync(ResourceHandle* handle, CFCachedURLResponseRef response)
+{
+ handle->continueWillCacheResponse(response);
+}
+#elif PLATFORM(MAC)
</ins><span class="cx"> void ResourceHandleClient::willCacheResponseAsync(ResourceHandle* handle, NSCachedURLResponse *response)
</span><span class="cx"> {
</span><span class="cx"> handle->continueWillCacheResponse(response);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceHandleClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceHandleClient.h (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceHandleClient.h        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/ResourceHandleClient.h        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -89,8 +89,10 @@
</span><span class="cx"> // Client will pass an updated request using ResourceHandle::continueCanAuthenticateAgainstProtectionSpace() when ready.
</span><span class="cx"> virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&);
</span><span class="cx"> #endif
</span><del>-#if PLATFORM(MAC) && !USE(CFNETWORK)
</del><span class="cx"> // Client will pass an updated request using ResourceHandle::continueWillCacheResponse() when ready.
</span><ins>+#if USE(CFNETWORK)
+ virtual void willCacheResponseAsync(ResourceHandle*, CFCachedURLResponseRef);
+#elif PLATFORM(MAC)
</ins><span class="cx"> virtual void willCacheResponseAsync(ResourceHandle*, NSCachedURLResponse *);
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> #include "FormDataStreamCFNet.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameLoader.h"
</span><del>-#include "LoaderRunLoopCF.h"
</del><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "NetworkingContext.h"
</span><span class="cx"> #include "ResourceError.h"
</span><span class="lines">@@ -52,11 +51,8 @@
</span><span class="cx"> #include <wtf/text/Base64.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
-#include "WebCoreThread.h"
-#endif // PLATFORM(IOS)
-
</del><span class="cx"> #if PLATFORM(MAC)
</span><ins>+#include "ResourceHandleCFURLConnectionDelegateWithOperationQueue.h"
</ins><span class="cx"> #include "WebCoreSystemInterface.h"
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx"> #include "WebCoreURLResponse.h"
</span><span class="lines">@@ -105,6 +101,9 @@
</span><span class="cx">
</span><span class="cx"> ResourceHandleInternal::~ResourceHandleInternal()
</span><span class="cx"> {
</span><ins>+ if (m_connectionDelegate)
+ m_connectionDelegate->releaseHandle();
+
</ins><span class="cx"> if (m_connection) {
</span><span class="cx"> LOG(Network, "CFNet - Cancelling connection %p (%s)", m_connection.get(), m_firstRequest.url().string().utf8().data());
</span><span class="cx"> CFURLConnectionCancel(m_connection.get());
</span><span class="lines">@@ -204,11 +203,18 @@
</span><span class="cx"> CFDictionaryAddValue(propertiesDictionary.get(), kCFURLConnectionSocketStreamProperties, streamProperties);
</span><span class="cx"> CFRelease(streamProperties);
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
- CFURLRequestSetShouldStartSynchronously(request.get(), 1);
</del><ins>+
+
+#if PLATFORM(MAC)
+ if (client() && client()->usesAsyncCallbacks())
+ d->m_connectionDelegate = adoptRef(new ResourceHandleCFURLConnectionDelegateWithOperationQueue(this));
+ else
+ d->m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this));
+#else
+ d->m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this));
</ins><span class="cx"> #endif
</span><ins>+ d->m_connectionDelegate->setupRequest(request.get());
</ins><span class="cx">
</span><del>- d->m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this));
</del><span class="cx"> CFURLConnectionClient_V6 client = d->m_connectionDelegate->makeConnectionClient();
</span><span class="cx">
</span><span class="cx"> d->m_connection = adoptCF(CFURLConnectionCreateWithProperties(0, request.get(), reinterpret_cast<CFURLConnectionClient*>(&client), propertiesDictionary.get()));
</span><span class="lines">@@ -230,14 +236,7 @@
</span><span class="cx">
</span><span class="cx"> createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, client()->connectionProperties(this).get());
</span><span class="cx">
</span><del>-#if PLATFORM(WIN)
- CFURLConnectionScheduleWithCurrentMessageQueue(d->m_connection.get());
-#elif PLATFORM(IOS)
- CFURLConnectionScheduleWithRunLoop(d->m_connection.get(), WebThreadRunLoop(), kCFRunLoopDefaultMode);
-#else
- CFURLConnectionScheduleWithRunLoop(d->m_connection.get(), CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
-#endif
- CFURLConnectionScheduleDownloadWithRunLoop(d->m_connection.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
</del><ins>+ d->m_connectionDelegate->setupConnectionScheduling(d->m_connection.get());
</ins><span class="cx"> CFURLConnectionStart(d->m_connection.get());
</span><span class="cx">
</span><span class="cx"> LOG(Network, "CFNet - Starting URL %s (handle=%p, conn=%p)", firstRequest().url().string().utf8().data(), this, d->m_connection.get());
</span><span class="lines">@@ -293,9 +292,12 @@
</span><span class="cx"> bool ResourceHandle::shouldUseCredentialStorage()
</span><span class="cx"> {
</span><span class="cx"> LOG(Network, "CFNet - shouldUseCredentialStorage()");
</span><del>- if (client())
- return client()->shouldUseCredentialStorage(this);
-
</del><ins>+ if (ResourceHandleClient* client = this->client()) {
+ if (client->usesAsyncCallbacks())
+ client->shouldUseCredentialStorageAsync(this);
+ else
+ return client->shouldUseCredentialStorage(this);
+ }
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -365,9 +367,12 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace)
</span><span class="cx"> {
</span><del>- if (client())
- return client()->canAuthenticateAgainstProtectionSpace(this, protectionSpace);
-
</del><ins>+ if (ResourceHandleClient* client = this->client()) {
+ if (client->usesAsyncCallbacks())
+ client->canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace);
+ else
+ return client->canAuthenticateAgainstProtectionSpace(this, protectionSpace);
+ }
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -552,6 +557,36 @@
</span><span class="cx"> {
</span><span class="cx"> return d->m_currentRequest;
</span><span class="cx"> }
</span><ins>+
+void ResourceHandle::continueWillSendRequest(const ResourceRequest& request)
+{
+ ResourceRequest requestResult = request;
+ if (!requestResult.isNull())
+ requestResult.setStorageSession(d->m_storageSession.get());
+ d->m_connectionDelegate->continueWillSendRequest(requestResult.cfURLRequest(UpdateHTTPBody));
+}
+
+void ResourceHandle::continueDidReceiveResponse()
+{
+ d->m_connectionDelegate->continueDidReceiveResponse();
+}
+
+void ResourceHandle::continueShouldUseCredentialStorage(bool useCredentialStorage)
+{
+ d->m_connectionDelegate->continueShouldUseCredentialStorage(useCredentialStorage);
+}
+
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+void ResourceHandle::continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate)
+{
+ d->m_connectionDelegate->continueCanAuthenticateAgainstProtectionSpace(canAuthenticate);
+}
+#endif
+
+void ResourceHandle::continueWillCacheResponse(CFCachedURLResponseRef response)
+{
+ d->m_connectionDelegate->continueWillCacheResponse(response);
+}
</ins><span class="cx"> #endif // USE(CFNETWORK)
</span><span class="cx">
</span><span class="cx"> #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -28,6 +28,18 @@
</span><span class="cx">
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx">
</span><ins>+#include "FormDataStreamCFNet.h"
+#include "NetworkingContext.h"
+#include "ResourceHandle.h"
+
+#if PLATFORM(MAC)
+#include "WebCoreSystemInterface.h"
+#endif
+
+#if PLATFORM(WIN)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> ResourceHandleCFURLConnectionDelegate::ResourceHandleCFURLConnectionDelegate(ResourceHandle* handle)
</span><span class="lines">@@ -39,6 +51,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ResourceHandleCFURLConnectionDelegate::releaseHandle()
+{
+ m_handle = nullptr;
+}
+
</ins><span class="cx"> CFURLRequestRef ResourceHandleCFURLConnectionDelegate::willSendRequestCallback(CFURLConnectionRef, CFURLRequestRef cfRequest, CFURLResponseRef originalRedirectResponse, const void* clientInfo)
</span><span class="cx"> {
</span><span class="cx"> return static_cast<ResourceHandleCFURLConnectionDelegate*>(const_cast<void*>(clientInfo))->willSendRequest(cfRequest, originalRedirectResponse);
</span><span class="lines">@@ -99,6 +116,61 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><span class="cx">
</span><ins>+RetainPtr<CFURLResponseRef> ResourceHandleCFURLConnectionDelegate::synthesizeRedirectResponseIfNecessary(CFURLRequestRef newRequest, CFURLResponseRef cfRedirectResponse)
+{
+ if (cfRedirectResponse)
+ return cfRedirectResponse;
+
+ CFURLRef newURL = CFURLRequestGetURL(newRequest);
+ RetainPtr<CFStringRef> newScheme = adoptCF(CFURLCopyScheme(newURL));
+
+ // If the protocols of the new request and the current request match, this is not an HSTS redirect and we shouldn't synthesize a redirect response.
+ const ResourceRequest& currentRequest = m_handle->currentRequest();
+ if (currentRequest.url().protocol() == String(newScheme.get()))
+ return nullptr;
+
+ RetainPtr<CFURLRef> currentURL = currentRequest.url().createCFURL();
+ RetainPtr<CFHTTPMessageRef> responseMessage = adoptCF(CFHTTPMessageCreateResponse(0, 302, 0, kCFHTTPVersion1_1));
+ RetainPtr<CFURLRef> newAbsoluteURL = adoptCF(CFURLCopyAbsoluteURL(newURL));
+ CFHTTPMessageSetHeaderFieldValue(responseMessage.get(), CFSTR("Location"), CFURLGetString(newAbsoluteURL.get()));
+ CFHTTPMessageSetHeaderFieldValue(responseMessage.get(), CFSTR("Cache-Control"), CFSTR("no-store"));
+
+ RetainPtr<CFURLResponseRef> newResponse = adoptCF(CFURLResponseCreateWithHTTPResponse(0, currentURL.get(), responseMessage.get(), kCFURLCacheStorageNotAllowed));
+ return newResponse;
+}
+
+ResourceRequest ResourceHandleCFURLConnectionDelegate::createResourceRequest(CFURLRequestRef cfRequest, CFURLResponseRef redirectResponse)
+{
+ ResourceRequest request;
+ CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(redirectResponse);
+ if (httpMessage && CFHTTPMessageGetResponseStatusCode(httpMessage) == 307) {
+ RetainPtr<CFStringRef> lastHTTPMethod = m_handle->lastHTTPMethod().createCFString();
+ RetainPtr<CFStringRef> newMethod = adoptCF(CFURLRequestCopyHTTPRequestMethod(cfRequest));
+ if (CFStringCompareWithOptions(lastHTTPMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(lastHTTPMethod.get())), kCFCompareCaseInsensitive)) {
+ RetainPtr<CFMutableURLRequestRef> mutableRequest = adoptCF(CFURLRequestCreateMutableCopy(0, cfRequest));
+ wkSetRequestStorageSession(m_handle->storageSession(), mutableRequest.get());
+ CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), lastHTTPMethod.get());
+
+ FormData* body = m_handle->firstRequest().httpBody();
+ if (!equalIgnoringCase(m_handle->firstRequest().httpMethod(), "GET") && body && !body->isEmpty())
+ WebCore::setHTTPBody(mutableRequest.get(), body);
+
+ String originalContentType = m_handle->firstRequest().httpContentType();
+ if (!originalContentType.isEmpty())
+ CFURLRequestSetHTTPHeaderFieldValue(mutableRequest.get(), CFSTR("Content-Type"), originalContentType.createCFString().get());
+
+ request = mutableRequest.get();
+ }
+ }
+
+ if (request.isNull())
+ request = cfRequest;
+
+ if (!request.url().protocolIs("https") && protocolIs(request.httpReferrer(), "https") && m_handle->context()->shouldClearReferrerOnHTTPSToHTTPRedirect())
+ request.clearHTTPReferrer();
+ return request;
+}
+
</ins><span class="cx"> CFURLConnectionClient_V6 ResourceHandleCFURLConnectionDelegate::makeConnectionClient() const
</span><span class="cx"> {
</span><span class="cx"> CFURLConnectionClient_V6 client = { 6, this, 0, 0, 0,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -28,7 +28,9 @@
</span><span class="cx">
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx">
</span><ins>+#include "ResourceRequest.h"
</ins><span class="cx"> #include <CFNetwork/CFURLConnectionPriv.h>
</span><ins>+#include <wtf/RetainPtr.h>
</ins><span class="cx"> #include <wtf/ThreadSafeRefCounted.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -41,7 +43,22 @@
</span><span class="cx"> virtual ~ResourceHandleCFURLConnectionDelegate();
</span><span class="cx">
</span><span class="cx"> CFURLConnectionClient_V6 makeConnectionClient() const;
</span><ins>+ virtual void setupRequest(CFMutableURLRequestRef) = 0;
+ virtual void setupConnectionScheduling(CFURLConnectionRef) = 0;
+ void releaseHandle();
</ins><span class="cx">
</span><ins>+ virtual void continueWillSendRequest(CFURLRequestRef) = 0;
+ virtual void continueDidReceiveResponse() = 0;
+ virtual void continueShouldUseCredentialStorage(bool) = 0;
+ virtual void continueWillCacheResponse(CFCachedURLResponseRef) = 0;
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+ virtual void continueCanAuthenticateAgainstProtectionSpace(bool) = 0;
+#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
+
+protected:
+ RetainPtr<CFURLResponseRef> synthesizeRedirectResponseIfNecessary(CFURLRequestRef, CFURLResponseRef);
+ ResourceRequest createResourceRequest(CFURLRequestRef, CFURLResponseRef);
+
</ins><span class="cx"> private:
</span><span class="cx"> static CFURLRequestRef willSendRequestCallback(CFURLConnectionRef, CFURLRequestRef, CFURLResponseRef, const void* clientInfo);
</span><span class="cx"> static void didReceiveResponseCallback(CFURLConnectionRef, CFURLResponseRef, const void* clientInfo);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueuecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp (0 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -0,0 +1,314 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ResourceHandleCFURLConnectionDelegateWithOperationQueue.h"
+
+#if USE(CFNETWORK)
+
+#include "AuthenticationCF.h"
+#include "AuthenticationChallenge.h"
+#include "Logging.h"
+#include "ResourceHandle.h"
+#include "ResourceHandleClient.h"
+#include "ResourceResponse.h"
+#include "SharedBuffer.h"
+#include "WebCoreSystemInterface.h"
+#include "WebCoreURLResponse.h"
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle* handle)
+ : ResourceHandleCFURLConnectionDelegate(handle)
+ , m_queue(dispatch_queue_create("com.apple.WebCore/CFNetwork", DISPATCH_QUEUE_SERIAL))
+ , m_semaphore(dispatch_semaphore_create(0))
+{
+ dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
+ dispatch_set_target_queue(m_queue, backgroundQueue);
+}
+
+ResourceHandleCFURLConnectionDelegateWithOperationQueue::~ResourceHandleCFURLConnectionDelegateWithOperationQueue()
+{
+ dispatch_release(m_semaphore);
+ dispatch_release(m_queue);
+}
+
+bool ResourceHandleCFURLConnectionDelegateWithOperationQueue::hasHandle() const
+{
+ return !!m_handle;
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest(CFMutableURLRequestRef)
+{
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupConnectionScheduling(CFURLConnectionRef connection)
+{
+ CFURLConnectionSetDelegateDispatchQueue(connection, m_queue);
+}
+
+CFURLRequestRef ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest(CFURLRequestRef cfRequest, CFURLResponseRef originalRedirectResponse)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (protector->hasHandle()) {
+ continueWillSendRequest(nullptr);
+ return;
+ }
+
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ RetainPtr<CFURLResponseRef> redirectResponse = synthesizeRedirectResponseIfNecessary(cfRequest, originalRedirectResponse);
+ if (!redirectResponse) {
+ m_handle->continueWillSendRequest(cfRequest);
+ return;
+ }
+
+ ResourceRequest request = createResourceRequest(cfRequest, redirectResponse.get());
+ m_handle->willSendRequest(request, redirectResponse.get());
+ });
+
+ dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
+
+ return m_requestResult.leakRef();
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLResponseRef cfResponse)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (protector->hasHandle()) {
+ continueDidReceiveResponse();
+ return;
+ }
+
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ // Avoid MIME type sniffing if the response comes back as 304 Not Modified.
+ CFHTTPMessageRef msg = wkGetCFURLResponseHTTPResponse(cfResponse);
+ int statusCode = msg ? CFHTTPMessageGetResponseStatusCode(msg) : 0;
+
+ if (statusCode != 304)
+ adjustMIMETypeIfNecessary(cfResponse);
+
+#if !PLATFORM(IOS)
+ if (_CFURLRequestCopyProtocolPropertyForKey(m_handle->firstRequest().cfURLRequest(DoNotUpdateHTTPBody), CFSTR("ForceHTMLMIMEType")))
+ wkSetCFURLResponseMIMEType(cfResponse, CFSTR("text/html"));
+#endif // !PLATFORM(IOS)
+
+ m_handle->client()->didReceiveResponseAsync(m_handle, cfResponse);
+ });
+ dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData(CFDataRef data, CFIndex originalLength)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+ CFRetain(data);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!protector->hasHandle()) {
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->client()->didReceiveBuffer(m_handle, SharedBuffer::wrapCFData(data), originalLength);
+ }
+
+ CFRelease(data);
+ });
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading()
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (protector->hasHandle())
+ return;
+
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->client()->didFinishLoading(m_handle, 0);
+ });
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail(CFErrorRef error)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+ CFRetain(error);
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!protector->hasHandle()) {
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->client()->didFail(m_handle, ResourceError(error));
+ }
+
+ CFRelease(error);
+ });
+}
+
+CFCachedURLResponseRef ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse(CFCachedURLResponseRef cachedResponse)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (protector->hasHandle()) {
+ continueWillCacheResponse(nullptr);
+ return;
+ }
+
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->client()->willCacheResponseAsync(m_handle, cachedResponse);
+ });
+ dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
+ return m_cachedResponseResult.leakRef();
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge(CFURLAuthChallengeRef challenge)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+ CFRetain(challenge);
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!protector->hasHandle()) {
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(challenge, m_handle));
+ }
+
+ CFRelease(challenge);
+ });
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (protector->hasHandle())
+ return;
+
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->client()->didSendData(m_handle, totalBytesWritten, totalBytesExpectedToWrite);
+ });
+}
+
+Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage()
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (protector->hasHandle()) {
+ continueShouldUseCredentialStorage(false);
+ return;
+ }
+
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->shouldUseCredentialStorage();
+ });
+ dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
+ return m_boolResult;
+}
+
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(CFURLProtectionSpaceRef protectionSpace)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (protector->hasHandle()) {
+ continueCanAuthenticateAgainstProtectionSpace(false);
+ return;
+ }
+
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ ProtectionSpace coreProtectionSpace = core(protectionSpace);
+#if PLATFORM(IOS)
+ if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown) {
+ m_boolResult = false;
+ dispatch_semaphore_signal(m_semaphore);
+ return;
+ }
+#endif // PLATFORM(IOS)
+ m_handle->canAuthenticateAgainstProtectionSpace(coreProtectionSpace);
+ });
+ dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
+ return m_boolResult;
+}
+#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
+
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray(CFArrayRef dataArray)
+{
+ RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this);
+ CFRetain(dataArray);
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!protector->hasHandle()) {
+ LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+
+ m_handle->handleDataArray(dataArray);
+ }
+ CFRelease(dataArray);
+ });
+}
+#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest(CFURLRequestRef request)
+{
+ m_requestResult = request;
+ dispatch_semaphore_signal(m_semaphore);
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse()
+{
+ dispatch_semaphore_signal(m_semaphore);
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueShouldUseCredentialStorage(bool shouldUseCredentialStorage)
+{
+ m_boolResult = shouldUseCredentialStorage;
+ dispatch_semaphore_signal(m_semaphore);
+}
+
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse(CFCachedURLResponseRef response)
+{
+ m_cachedResponseResult = response;
+ dispatch_semaphore_signal(m_semaphore);
+}
+
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate)
+{
+ m_boolResult = canAuthenticate;
+ dispatch_semaphore_signal(m_semaphore);
+}
+#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
+} // namespace WebCore
+
+#endif // USE(CFNETWORK)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFURLConnectionDelegateWithOperationQueueh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h (0 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h         (rev 0)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ResourceHandleCFURLConnectionDelegateWithOperationQueue_h
+#define ResourceHandleCFURLConnectionDelegateWithOperationQueue_h
+
+#if USE(CFNETWORK)
+
+#include "ResourceHandleCFURLConnectionDelegate.h"
+#include <CFNetwork/CFNetwork.h>
+#include <dispatch/queue.h>
+#include <dispatch/semaphore.h>
+
+namespace WebCore {
+
+class ResourceHandleCFURLConnectionDelegateWithOperationQueue FINAL : public ResourceHandleCFURLConnectionDelegate {
+public:
+ ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle*);
+ virtual ~ResourceHandleCFURLConnectionDelegateWithOperationQueue();
+
+private:
+ bool hasHandle() const;
+
+ virtual void setupRequest(CFMutableURLRequestRef) OVERRIDE;
+ virtual void setupConnectionScheduling(CFURLConnectionRef) OVERRIDE;
+
+ virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) OVERRIDE;
+ virtual void didReceiveResponse(CFURLResponseRef) OVERRIDE;
+ virtual void didReceiveData(CFDataRef, CFIndex originalLength) OVERRIDE;
+ virtual void didFinishLoading() OVERRIDE;
+ virtual void didFail(CFErrorRef) OVERRIDE;
+ virtual CFCachedURLResponseRef willCacheResponse(CFCachedURLResponseRef) OVERRIDE;
+ virtual void didReceiveChallenge(CFURLAuthChallengeRef) OVERRIDE;
+ virtual void didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) OVERRIDE;
+ virtual Boolean shouldUseCredentialStorage() OVERRIDE;
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+ virtual Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) OVERRIDE;
+#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
+#if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+ virtual void didReceiveDataArray(CFArrayRef dataArray) OVERRIDE;
+#endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
+
+ virtual void continueWillSendRequest(CFURLRequestRef) OVERRIDE;
+ virtual void continueDidReceiveResponse() OVERRIDE;
+ virtual void continueShouldUseCredentialStorage(bool) OVERRIDE;
+ virtual void continueWillCacheResponse(CFCachedURLResponseRef) OVERRIDE;
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+ virtual void continueCanAuthenticateAgainstProtectionSpace(bool) OVERRIDE;
+#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
+
+ dispatch_queue_t m_queue;
+ dispatch_semaphore_t m_semaphore;
+
+ RetainPtr<CFURLRequestRef> m_requestResult;
+ RetainPtr<CFCachedURLResponseRef> m_cachedResponseResult;
+ bool m_boolResult;
+};
+
+} // namespace WebCore.
+
+#endif // USE(CFNETWORK)
+
+#endif // ResourceHandleCFURLConnectionDelegateWithOperationQueue_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -30,12 +30,10 @@
</span><span class="cx">
</span><span class="cx"> #include "AuthenticationCF.h"
</span><span class="cx"> #include "AuthenticationChallenge.h"
</span><del>-#include "FormDataStreamCFNet.h"
</del><ins>+#include "LoaderRunLoopCF.h"
</ins><span class="cx"> #include "Logging.h"
</span><del>-#include "NetworkingContext.h"
</del><span class="cx"> #include "ResourceHandle.h"
</span><span class="cx"> #include "ResourceHandleClient.h"
</span><del>-#include "ResourceRequest.h"
</del><span class="cx"> #include "ResourceResponse.h"
</span><span class="cx"> #include "SharedBuffer.h"
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="lines">@@ -47,9 +45,12 @@
</span><span class="cx"> #include "WebCoreURLResponse.h"
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+#include "WebCoreThread.h"
+#endif // PLATFORM(IOS)
+
</ins><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx"> #include "MIMETypeRegistry.h"
</span><del>-#include <WebKitSystemInterface/WebKitSystemInterface.h>
</del><span class="cx"> #endif // PLATFORM(WIN)
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -59,31 +60,28 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static RetainPtr<CFURLResponseRef> synthesizeRedirectResponseIfNecessary(const ResourceRequest& currentRequest, CFURLRequestRef newRequest, CFURLResponseRef cfRedirectResponse)
</del><ins>+void SynchronousResourceHandleCFURLConnectionDelegate::setupRequest(CFMutableURLRequestRef request)
</ins><span class="cx"> {
</span><del>- if (cfRedirectResponse)
- return cfRedirectResponse;
</del><ins>+#if PLATFORM(IOS)
+ CFURLRequestSetShouldStartSynchronously(request, 1);
+#endif
+}
</ins><span class="cx">
</span><del>- CFURLRef newURL = CFURLRequestGetURL(newRequest);
- RetainPtr<CFStringRef> newScheme = adoptCF(CFURLCopyScheme(newURL));
-
- // If the protocols of the new request and the current request match, this is not an HSTS redirect and we shouldn't synthesize a redirect response.
- if (currentRequest.url().protocol() == String(newScheme.get()))
- return 0;
-
- RetainPtr<CFURLRef> currentURL = currentRequest.url().createCFURL();
- RetainPtr<CFHTTPMessageRef> responseMessage = adoptCF(CFHTTPMessageCreateResponse(0, 302, 0, kCFHTTPVersion1_1));
- RetainPtr<CFURLRef> newAbsoluteURL = adoptCF(CFURLCopyAbsoluteURL(newURL));
- CFHTTPMessageSetHeaderFieldValue(responseMessage.get(), CFSTR("Location"), CFURLGetString(newAbsoluteURL.get()));
- CFHTTPMessageSetHeaderFieldValue(responseMessage.get(), CFSTR("Cache-Control"), CFSTR("no-store"));
-
- RetainPtr<CFURLResponseRef> newResponse = adoptCF(CFURLResponseCreateWithHTTPResponse(0, currentURL.get(), responseMessage.get(), kCFURLCacheStorageNotAllowed));
- return newResponse;
</del><ins>+void SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling(CFURLConnectionRef connection)
+{
+#if PLATFORM(WIN)
+ CFURLConnectionScheduleWithCurrentMessageQueue(connection);
+#elif PLATFORM(IOS)
+ CFURLConnectionScheduleWithRunLoop(connection, WebThreadRunLoop(), kCFRunLoopDefaultMode);
+#else
+ CFURLConnectionScheduleWithRunLoop(connection, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+#endif
+ CFURLConnectionScheduleDownloadWithRunLoop(connection, loaderRunLoop(), kCFRunLoopDefaultMode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> CFURLRequestRef SynchronousResourceHandleCFURLConnectionDelegate::willSendRequest(CFURLRequestRef cfRequest, CFURLResponseRef originalRedirectResponse)
</span><span class="cx"> {
</span><del>- RetainPtr<CFURLResponseRef> redirectResponse = synthesizeRedirectResponseIfNecessary(m_handle->currentRequest(), cfRequest, originalRedirectResponse);
</del><ins>+ RetainPtr<CFURLResponseRef> redirectResponse = synthesizeRedirectResponseIfNecessary(cfRequest, originalRedirectResponse);
</ins><span class="cx">
</span><span class="cx"> if (!redirectResponse) {
</span><span class="cx"> CFRetain(cfRequest);
</span><span class="lines">@@ -92,34 +90,7 @@
</span><span class="cx">
</span><span class="cx"> LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::willSendRequest(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
</span><span class="cx">
</span><del>- ResourceRequest request;
- CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(redirectResponse.get());
- if (httpMessage && CFHTTPMessageGetResponseStatusCode(httpMessage) == 307) {
- RetainPtr<CFStringRef> lastHTTPMethod = m_handle->lastHTTPMethod().createCFString();
- RetainPtr<CFStringRef> newMethod = adoptCF(CFURLRequestCopyHTTPRequestMethod(cfRequest));
- if (CFStringCompareWithOptions(lastHTTPMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(lastHTTPMethod.get())), kCFCompareCaseInsensitive)) {
- RetainPtr<CFMutableURLRequestRef> mutableRequest = adoptCF(CFURLRequestCreateMutableCopy(0, cfRequest));
- wkSetRequestStorageSession(m_handle->storageSession(), mutableRequest.get());
- CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), lastHTTPMethod.get());
-
- FormData* body = m_handle->firstRequest().httpBody();
- if (!equalIgnoringCase(m_handle->firstRequest().httpMethod(), "GET") && body && !body->isEmpty())
- WebCore::setHTTPBody(mutableRequest.get(), body);
-
- String originalContentType = m_handle->firstRequest().httpContentType();
- if (!originalContentType.isEmpty())
- CFURLRequestSetHTTPHeaderFieldValue(mutableRequest.get(), CFSTR("Content-Type"), originalContentType.createCFString().get());
-
- request = mutableRequest.get();
- }
- }
- if (request.isNull())
- request = cfRequest;
-
- // Should not set Referer after a redirect from a secure resource to non-secure one.
- if (!request.url().protocolIs("https") && protocolIs(request.httpReferrer(), "https") && m_handle->context()->shouldClearReferrerOnHTTPSToHTTPRedirect())
- request.clearHTTPReferrer();
-
</del><ins>+ ResourceRequest request = createResourceRequest(cfRequest, redirectResponse.get());
</ins><span class="cx"> m_handle->willSendRequest(request, redirectResponse.get());
</span><span class="cx">
</span><span class="cx"> if (request.isNull())
</span><span class="lines">@@ -301,6 +272,33 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><span class="cx">
</span><ins>+void SynchronousResourceHandleCFURLConnectionDelegate::continueWillSendRequest(CFURLRequestRef)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void SynchronousResourceHandleCFURLConnectionDelegate::continueDidReceiveResponse()
+{
+ ASSERT_NOT_REACHED();
+}
+
+void SynchronousResourceHandleCFURLConnectionDelegate::continueShouldUseCredentialStorage(bool)
+{
+ ASSERT_NOT_REACHED();
+}
+
+void SynchronousResourceHandleCFURLConnectionDelegate::continueWillCacheResponse(CFCachedURLResponseRef)
+{
+ ASSERT_NOT_REACHED();
+}
+
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+void SynchronousResourceHandleCFURLConnectionDelegate::continueCanAuthenticateAgainstProtectionSpace(bool)
+{
+ ASSERT_NOT_REACHED();
+}
+#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
+
</ins><span class="cx"> } // namespace WebCore.
</span><span class="cx">
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSynchronousResourceHandleCFURLConnectionDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h (160466 => 160467)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h        2013-12-12 01:26:03 UTC (rev 160466)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h        2013-12-12 01:56:25 UTC (rev 160467)
</span><span class="lines">@@ -44,6 +44,9 @@
</span><span class="cx"> #endif // USE(NETWORK_CFDATA_ARRAY_CALLBACK)
</span><span class="cx">
</span><span class="cx"> private:
</span><ins>+ virtual void setupRequest(CFMutableURLRequestRef) OVERRIDE;
+ virtual void setupConnectionScheduling(CFURLConnectionRef) OVERRIDE;
+
</ins><span class="cx"> virtual CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) OVERRIDE;
</span><span class="cx"> virtual void didReceiveResponse(CFURLResponseRef) OVERRIDE;
</span><span class="cx"> virtual CFCachedURLResponseRef willCacheResponse(CFCachedURLResponseRef) OVERRIDE;
</span><span class="lines">@@ -53,6 +56,14 @@
</span><span class="cx"> #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><span class="cx"> virtual Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) OVERRIDE;
</span><span class="cx"> #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
</span><ins>+
+ virtual void continueWillSendRequest(CFURLRequestRef) OVERRIDE;
+ virtual void continueDidReceiveResponse() OVERRIDE;
+ virtual void continueShouldUseCredentialStorage(bool) OVERRIDE;
+ virtual void continueWillCacheResponse(CFCachedURLResponseRef) OVERRIDE;
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+ virtual void continueCanAuthenticateAgainstProtectionSpace(bool) OVERRIDE;
+#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore.
</span></span></pre>
</div>
</div>
</body>
</html>