Changeset 223271 in webkit
- Timestamp:
- Oct 12, 2017 6:55:24 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223265 r223271 1 2017-10-12 Alex Christensen <achristensen@webkit.org> 2 3 Use asynchronous ResourceHandleClient calls for WebKit1 4 https://bugs.webkit.org/show_bug.cgi?id=160677 5 6 Reviewed by Brady Eidson. 7 8 * TestExpectations: 9 * platform/gtk/TestExpectations: 10 * platform/ios-wk2/TestExpectations: 11 * platform/mac-wk2/TestExpectations: 12 * platform/wk2/TestExpectations: 13 14 http/tests/cache/iframe-304-crash.html used to deterministically record its didFinishLoading callback, 15 but only for WK1. It was marked as flaky for all WK2 ports. It is now flaky in WK1 because the order 16 of the testRunner.notifyDone call and the didFinishLoading logging is no longer deterministic with 17 asynchronous loading, but the test still verifies that there is no crash. 18 19 http/tests/security/cross-origin-modal-dialog-base.html does navigation during showModalDialog, which 20 probably should've never worked in WK1 and never worked in WK2. WK1 behavior now matches WK2 behavior. 21 I'm not aware of any complaints about no navigation working during showModalDialog in WK2 and I imagine 22 nobody will be regressed by this change, but if we do find such a problem, creative use of MessageQueues 23 like we do with sync xhr in WK1 now could theoretically fix the problem, but we are trying to get 24 rid of showModalDialog anyway. The test was written to verify that the SecurityOrigin doesn't fall back 25 to the wrong origin, and it certainly doesn't now. 26 27 These tests dump load delegate call order, which are less deterministic now but the tests still behave correctly. 28 http/tests/svg/svg-use-external.html 29 http/tests/loading/text-content-type-with-binary-extension.html 30 http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-iframe-in-main-frame.html 31 1 32 2017-10-12 Youenn Fablet <youenn@apple.com> 2 33 -
trunk/LayoutTests/TestExpectations
r223265 r223271 40 40 # window.showModalDialog is only tested in DumpRenderTree on Mac. 41 41 editing/execCommand/show-modal-dialog-during-execCommand.html [ Skip ] 42 http/tests/security/cross-origin-modal-dialog-base.html [ Skip ] 43 fast/events/scroll-event-during-modal-dialog.html [ Skip ] 44 fast/harness/show-modal-dialog.html [ Skip ] 42 45 43 46 fast/shadow-dom/touch-event-on-text-assigned-to-slot.html [ Skip ] … … 435 438 webkit.org/b/169565 imported/w3c/web-platform-tests/cors/status-async.htm [ Failure ] 436 439 webkit.org/b/169565 imported/w3c/web-platform-tests/cors/304.htm [ Failure ] 440 441 # These tests used to have deterministic load delegate callback order before webkit.org/b/160677 442 http/tests/svg/svg-use-external.html [ Pass Failure ] 443 http/tests/loading/text-content-type-with-binary-extension.html [ Pass Failure ] 444 http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-iframe-in-main-frame.html [ Pass Failure ] 437 445 438 446 # Tests that are flakey due to unhandled promise rejection error messages … … 770 778 webkit.org/b/140043 js/dom/Promise.html [ Pass Failure ] 771 779 780 webkit.org/b/134550 http/tests/cache/iframe-304-crash.html [ Failure Pass ] 772 781 webkit.org/b/141267 http/tests/misc/detached-frame-console.html [ Pass Failure ] 773 782 -
trunk/LayoutTests/platform/gtk/TestExpectations
r223253 r223271 1650 1650 webkit.org/b/36642 fast/replaced/border-radius-clip.html [ Failure Pass Crash ] 1651 1651 1652 webkit.org/b/134550 http/tests/cache/iframe-304-crash.html [ Failure Pass ]1653 1654 1652 webkit.org/b/134573 media/track/audio-track.html [ Failure Timeout Pass ] 1655 1653 webkit.org/b/134576 media/track/audio/audio-track-mkv-vorbis-language.html [ Failure Timeout Pass ] -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r223160 r223271 447 447 448 448 # HTTP tests that are flaky: 449 http/tests/cache/iframe-304-crash.html [ Failure Pass ]450 449 http/tests/navigation/forward-and-cancel.html [ Failure Pass ] 451 450 http/tests/security/xss-DENIED-xsl-external-entity-redirect.xml [ Failure Pass ] -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r223243 r223271 298 298 webkit.org/b/162999 accessibility/mac/wk1-set-selected-text-marker-range-input-element.html [ Skip ] 299 299 300 webkit.org/b/134550 http/tests/cache/iframe-304-crash.html [ Pass Failure ]301 302 300 # testRunner.setUseDeferredFrameLoading is not implemented. 303 301 webkit.org/b/93980 http/tests/appcache/load-from-appcache-defer-resume-crash.html [ Skip ] -
trunk/LayoutTests/platform/wk2/TestExpectations
r223253 r223271 265 265 fast/events/scroll-event-during-modal-dialog.html 266 266 fast/harness/show-modal-dialog.html 267 http/tests/security/cross-origin-modal-dialog-base.html [ Skip ]268 267 269 268 # WebKit2 needs to support synchronous creation of about:blank/data:url frames -
trunk/LayoutTests/security/block-test.html
r222623 r223271 68 68 } 69 69 } 70 71 function makeImage() { 72 var image = document.createElement("img"); 73 image.onerror=nextBlockedPortTest; 74 image.src="http://255.255.255.255:1/test.jpg"; 75 image.id="testIMG"; 76 document.body.appendChild(image); 77 } 70 78 </script> 71 <body >79 <body onload="makeImage()"> 72 80 <p>This test attempts to change the src of an IMG tag to all black listed ports to confirm that WebKit returns the 73 81 correct error for them - blocked instead of cannot find. It also tries the FTP ports for exemptions. Due to the 74 82 nature of this test, the results can only be processed automatically via DumpRenderTree 75 83 </p> 76 <img id="testIMG" src="http://255.255.255.255:1/test.jpg" onError="nextBlockedPortTest();"></img>77 84 </body> 78 85 </html> -
trunk/LayoutTests/svg/in-html/by-reference.html
r115773 r223271 5 5 --> 6 6 <head> 7 <script> 8 if (window.testRunner) 9 testRunner.waitUntilDone(); 10 var elementsLoaded = 0; 11 function loaded() { 12 if (window.testRunner && ++elementsLoaded == 5) 13 testRunner.notifyDone(); 14 } 15 </script> 7 16 <style type='text/css'> 8 17 * { … … 22 31 <body> 23 32 <div> 24 <object type='image/svg+xml' width='50' height='50' data='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></object>25 <embed width='50' height='50' src='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></embed>26 <iframe width='100' height='100' src='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></iframe>27 <object type='text/xml' width='50' height='50' data='data:text/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></object>28 <object type='application/xml' width='50' height='50' data='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></object-->33 <object onload="loaded()" type='image/svg+xml' width='50' height='50' data='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></object> 34 <embed onload="loaded()" width='50' height='50' src='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></embed> 35 <iframe onload="loaded()" width='100' height='100' src='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></iframe> 36 <object onload="loaded()" type='text/xml' width='50' height='50' data='data:text/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></object> 37 <object onload="loaded()" type='application/xml' width='50' height='50' data='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4='></object--> 29 38 </div> 30 39 </body> -
trunk/Source/WebCore/ChangeLog
r223264 r223271 1 2017-10-12 Alex Christensen <achristensen@webkit.org> 2 3 Use asynchronous ResourceHandleClient calls for WebKit1 4 https://bugs.webkit.org/show_bug.cgi?id=160677 5 6 Reviewed by Brady Eidson. 7 8 Covered by existing tests. 9 10 * PlatformAppleWin.cmake: 11 * PlatformMac.cmake: 12 * WebCore.xcodeproj/project.pbxproj: 13 * loader/ResourceLoader.cpp: 14 (WebCore::ResourceLoader::willSendRequestAsync): 15 (WebCore::ResourceLoader::didReceiveResponseAsync): 16 (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): 17 * loader/ResourceLoader.h: 18 * loader/appcache/ApplicationCacheGroup.cpp: 19 (WebCore::ApplicationCacheGroup::didReceiveResponseAsync): 20 (WebCore::ApplicationCacheGroup::willSendRequestAsync): 21 (WebCore::ApplicationCacheGroup::canAuthenticateAgainstProtectionSpaceAsync): 22 (WebCore::ApplicationCacheGroup::didReceiveResponse): Deleted. 23 * loader/appcache/ApplicationCacheGroup.h: 24 * platform/network/BlobResourceHandle.cpp: 25 (WebCore::BlobResourceHandle::continueDidReceiveResponse): 26 (WebCore::BlobResourceHandle::getSizeForNext): 27 (WebCore::BlobResourceHandle::notifyResponseOnSuccess): 28 (WebCore::BlobResourceHandle::notifyResponseOnError): 29 * platform/network/PingHandle.h: 30 * platform/network/ResourceHandle.cpp: 31 (WebCore::ResourceHandle::didReceiveResponse): 32 (WebCore::ResourceHandle::usesAsyncCallbacks): Deleted. 33 * platform/network/ResourceHandle.h: 34 * platform/network/ResourceHandleClient.cpp: 35 (WebCore::ResourceHandleClient::~ResourceHandleClient): 36 (WebCore::ResourceHandleClient::willSendRequest): Deleted. 37 (WebCore::ResourceHandleClient::willSendRequestAsync): Deleted. 38 (WebCore::ResourceHandleClient::didReceiveResponseAsync): Deleted. 39 (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync): Deleted. 40 * platform/network/ResourceHandleClient.h: 41 (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge): 42 (WebCore::ResourceHandleClient::didReceiveResponse): Deleted. 43 (WebCore::ResourceHandleClient::usesAsyncCallbacks): Deleted. 44 (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpace): Deleted. 45 * platform/network/ResourceHandleInternal.h: 46 (WebCore::ResourceHandleInternal::ResourceHandleInternal): 47 * platform/network/SynchronousLoaderClient.cpp: 48 (WebCore::SynchronousLoaderClient::willSendRequestAsync): 49 (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync): 50 (WebCore::SynchronousLoaderClient::didReceiveResponseAsync): 51 (WebCore::SynchronousLoaderClient::didFinishLoading): 52 (WebCore::SynchronousLoaderClient::didFail): 53 (WebCore::SynchronousLoaderClient::willSendRequest): Deleted. 54 (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace): Deleted. 55 (WebCore::SynchronousLoaderClient::didReceiveResponse): Deleted. 56 * platform/network/SynchronousLoaderClient.h: 57 * platform/network/cf/ResourceHandleCFNet.cpp: 58 (WebCore::ResourceHandle::createCFURLConnection): 59 (WebCore::ResourceHandle::start): 60 (WebCore::ResourceHandle::willSendRequest): 61 (WebCore::ResourceHandle::shouldUseCredentialStorage): 62 (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace): 63 (WebCore::ResourceHandle::platformLoadResourceSynchronously): 64 * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: 65 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue): 66 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::releaseHandle): 67 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest): 68 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): 69 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData): 70 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading): 71 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail): 72 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse): 73 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge): 74 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData): 75 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage): 76 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace): 77 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace): 78 * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h: 79 * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Removed. 80 * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: Removed. 81 * platform/network/mac/ResourceHandleMac.mm: 82 (WebCore::ResourceHandle::start): 83 (WebCore::ResourceHandle::schedule): 84 (WebCore::ResourceHandle::makeDelegate): 85 (WebCore::ResourceHandle::delegate): 86 (WebCore::ResourceHandle::platformLoadResourceSynchronously): 87 (WebCore::ResourceHandle::willSendRequest): 88 (WebCore::ResourceHandle::continueWillSendRequest): 89 (WebCore::ResourceHandle::continueDidReceiveResponse): 90 (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace): 91 (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace): 92 (WebCore::ResourceHandle::continueWillCacheResponse): 93 (WebCore::ResourceHandle::shouldUseCredentialStorage): Deleted. 94 * platform/network/mac/WebCoreResourceHandleAsDelegate.h: Removed. 95 * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Removed. 96 * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h: 97 * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: 98 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]): 99 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]): 100 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]): 101 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): 102 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]): 103 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]): 104 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]): 105 (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]): 106 1 107 2017-10-12 Chris Dumez <cdumez@apple.com> 2 108 -
trunk/Source/WebCore/PlatformAppleWin.cmake
r222326 r223271 61 61 platform/network/cf/ResourceHandleCFNet.cpp 62 62 platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp 63 platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp 63 64 platform/network/cf/ResourceRequestCFNet.cpp 64 65 platform/network/cf/ResourceResponseCFNet.cpp 65 66 platform/network/cf/SocketStreamHandleImplCFNet.cpp 66 67 platform/network/cf/SynchronousLoaderClientCFNet.cpp 67 platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp68 68 ) 69 69 -
trunk/Source/WebCore/PlatformMac.cmake
r222917 r223271 563 563 platform/network/mac/SynchronousLoaderClient.mm 564 564 platform/network/mac/UTIUtilities.mm 565 platform/network/mac/WebCoreResourceHandleAsDelegate.mm566 565 platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 567 566 platform/network/mac/WebCoreURLResponse.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r223237 r223271 1115 1115 26FAE4CC1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */; }; 1116 1116 26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */; }; 1117 26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */; };1118 26FAE4CF1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */; };1119 1117 2914E3071CAB5A440049966F /* AccessibilityAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */; }; 1120 1118 2914E3081CAB5A440049966F /* AccessibilityAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */; }; … … 6720 6718 E17B492116A9B8FF001C8839 /* JSTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E17B491F16A9B8FF001C8839 /* JSTransitionEvent.h */; }; 6721 6719 E17B492216A9B8FF001C8839 /* JSTransitionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E17B492016A9B8FF001C8839 /* JSTransitionEvent.cpp */; }; 6722 E180810E16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E180810C16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm */; };6723 E180810F16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E180810D16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h */; };6724 6720 E180811216FCF42F00B80D07 /* SynchronousLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E180811016FCF42E00B80D07 /* SynchronousLoaderClient.cpp */; }; 6725 6721 E180811616FCF9CB00B80D07 /* SynchronousLoaderClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = E180811416FCF9CB00B80D07 /* SynchronousLoaderClient.mm */; }; … … 8791 8787 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; }; 8792 8788 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; }; 8793 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; };8794 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronousResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; };8795 8789 2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityAttachment.cpp; sourceTree = "<group>"; }; 8796 8790 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityAttachment.h; sourceTree = "<group>"; }; … … 15563 15557 E17B491F16A9B8FF001C8839 /* JSTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTransitionEvent.h; sourceTree = "<group>"; }; 15564 15558 E17B492016A9B8FF001C8839 /* JSTransitionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTransitionEvent.cpp; sourceTree = "<group>"; }; 15565 E180810C16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreResourceHandleAsDelegate.mm; sourceTree = "<group>"; };15566 E180810D16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreResourceHandleAsDelegate.h; sourceTree = "<group>"; };15567 15559 E180811016FCF42E00B80D07 /* SynchronousLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousLoaderClient.cpp; sourceTree = "<group>"; }; 15568 15560 E180811416FCF9CB00B80D07 /* SynchronousLoaderClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SynchronousLoaderClient.mm; sourceTree = "<group>"; }; … … 19643 19635 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */, 19644 19636 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */, 19645 E180810D16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h */,19646 E180810C16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm */,19647 19637 E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */, 19648 19638 E152551416FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm */, … … 24166 24156 51ABAE1D103C1913008C5260 /* SocketStreamHandleImplCFNet.cpp */, 24167 24157 442ABCD517D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp */, 24168 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */,24169 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */,24170 24158 ); 24171 24159 path = cf; … … 30619 30607 517A53461F50C17F00DCDC0A /* SWServerWorker.h in Headers */, 30620 30608 E180811716FCF9CB00B80D07 /* SynchronousLoaderClient.h in Headers */, 30621 26FAE4CF1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h in Headers */,30622 30609 0F03C0741884695E00A5F8CA /* SystemMemory.h in Headers */, 30623 30610 5D5975B319635F1100D00878 /* SystemVersion.h in Headers */, … … 30852 30839 DD05FE0D0B8BA3C6009ACDFE /* WebCoreObjCExtras.h in Headers */, 30853 30840 EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */, 30854 E180810F16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h in Headers */,30855 30841 E152551516FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h in Headers */, 30856 30842 A14832C7187F66C800DA63A6 /* WebCoreThread.h in Headers */, … … 34433 34419 E180811616FCF9CB00B80D07 /* SynchronousLoaderClient.mm in Sources */, 34434 34420 442ABCD617D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp in Sources */, 34435 26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */,34436 34421 E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */, 34437 34422 5D5975B419635F1100D00878 /* SystemVersion.mm in Sources */, … … 34646 34631 B50F5B810E96CD9900AD71A6 /* WebCoreObjCExtras.mm in Sources */, 34647 34632 9BDD18271F7E05F400E8E577 /* WebCorePasteboardFileReader.cpp in Sources */, 34648 E180810E16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm in Sources */,34649 34633 E152551616FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm in Sources */, 34650 34634 A14832C8187F673F00DA63A6 /* WebCoreThread.mm in Sources */, -
trunk/Source/WebCore/editing/cocoa/WebArchiveResourceFromNSAttributedString.mm
r222239 r223271 43 43 } 44 44 45 resource = ArchiveResource::create(SharedBuffer::create(adoptNS([data copy]).get()), URL, MIMEType, textEncodingName, frameName, nil);45 resource = ArchiveResource::create(SharedBuffer::create(adoptNS([data copy]).get()), URL, MIMEType, textEncodingName, frameName, { }); 46 46 if (!resource) { 47 47 [self release]; -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r222602 r223271 619 619 } 620 620 621 ResourceRequest ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest&& request, ResourceResponse&& redirectResponse) 622 { 623 if (documentLoader()->applicationCacheHost().maybeLoadFallbackForRedirect(this, request, redirectResponse)) 624 return WTFMove(request); 621 void ResourceLoader::willSendRequestAsync(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&& redirectResponse) 622 { 623 RefPtr<ResourceHandle> protectedHandle(handle); 624 if (documentLoader()->applicationCacheHost().maybeLoadFallbackForRedirect(this, request, redirectResponse)) { 625 handle->continueWillSendRequest(WTFMove(request)); 626 return; 627 } 625 628 willSendRequestInternal(request, redirectResponse); 626 return WTFMove(request);629 handle->continueWillSendRequest(WTFMove(request)); 627 630 } 628 631 … … 632 635 } 633 636 634 void ResourceLoader::didReceiveResponse(ResourceHandle*, ResourceResponse&& response) 635 { 636 if (documentLoader()->applicationCacheHost().maybeLoadFallbackForResponse(this, response)) 637 return; 637 void ResourceLoader::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& response) 638 { 639 if (documentLoader()->applicationCacheHost().maybeLoadFallbackForResponse(this, response)) { 640 handle->continueDidReceiveResponse(); 641 return; 642 } 638 643 didReceiveResponse(response); 644 handle->continueDidReceiveResponse(); 639 645 } 640 646 … … 707 713 708 714 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 715 void ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace& protectionSpace) 716 { 717 handle->continueCanAuthenticateAgainstProtectionSpace(canAuthenticateAgainstProtectionSpace(protectionSpace)); 718 } 709 719 710 720 bool ResourceLoader::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) -
trunk/Source/WebCore/loader/ResourceLoader.h
r219336 r223271 185 185 186 186 // ResourceHandleClient 187 ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&& redirectResponse) override;188 187 void didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; 189 void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override; 188 void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) override; 189 void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override; 190 190 void didReceiveData(ResourceHandle*, const char*, unsigned, int encodedDataLength) override; 191 191 void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength) override; … … 197 197 void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) override { didReceiveAuthenticationChallenge(challenge); } 198 198 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 199 bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace& protectionSpace) override { return canAuthenticateAgainstProtectionSpace(protectionSpace); }199 void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) override; 200 200 #endif 201 201 void receivedCancellation(ResourceHandle*, const AuthenticationChallenge& challenge) override { receivedCancellation(challenge); } -
trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
r223238 r223271 486 486 } 487 487 488 void ApplicationCacheGroup::didReceiveResponse (ResourceHandle* handle, ResourceResponse&& response)488 void ApplicationCacheGroup::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& response) 489 489 { 490 490 ASSERT(m_frame); … … 493 493 if (handle == m_manifestHandle) { 494 494 didReceiveManifestResponse(response); 495 handle->continueDidReceiveResponse(); 495 496 return; 496 497 } … … 519 520 // Load the next resource, if any. 520 521 startLoadingEntry(); 522 handle->continueDidReceiveResponse(); 521 523 return; 522 524 } … … 550 552 startLoadingEntry(); 551 553 } 554 handle->continueDidReceiveResponse(); 552 555 return; 553 556 } 554 557 555 558 m_currentResource = ApplicationCacheResource::create(url, response, type); 556 } 559 handle->continueDidReceiveResponse(); 560 } 561 562 void ApplicationCacheGroup::willSendRequestAsync(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&&) 563 { 564 handle->continueWillSendRequest(WTFMove(request)); 565 } 566 567 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 568 void ApplicationCacheGroup::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace&) 569 { 570 handle->continueCanAuthenticateAgainstProtectionSpace(false); 571 } 572 #endif 557 573 558 574 void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* data, unsigned length, int encodedDataLength) -
trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h
r212993 r223271 110 110 111 111 // ResourceHandleClient 112 void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override; 113 void didReceiveData(ResourceHandle*, const char*, unsigned length, int encodedDataLength) override; 114 void didFinishLoading(ResourceHandle*) override; 115 void didFail(ResourceHandle*, const ResourceError&) override; 112 void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) final; 113 void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) final; 114 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 115 void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) final; 116 #endif 117 void didReceiveData(ResourceHandle*, const char*, unsigned length, int encodedDataLength) final; 118 void didFinishLoading(ResourceHandle*) final; 119 void didFail(ResourceHandle*, const ResourceError&) final; 116 120 117 121 void didReceiveManifestResponse(const ResourceResponse&); -
trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp
r215686 r223271 75 75 BlobResourceSynchronousLoader(ResourceError&, ResourceResponse&, Vector<char>&); 76 76 77 void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override; 78 void didFail(ResourceHandle*, const ResourceError&) override; 77 void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) final; 78 void didFail(ResourceHandle*, const ResourceError&) final; 79 void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) final; 80 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 81 void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) final; 82 #endif 79 83 80 84 private: … … 91 95 } 92 96 93 void BlobResourceSynchronousLoader::didReceiveResponse(ResourceHandle* handle, ResourceResponse&& response) 97 void BlobResourceSynchronousLoader::willSendRequestAsync(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&&) 98 { 99 ASSERT_NOT_REACHED(); 100 handle->continueWillSendRequest(WTFMove(request)); 101 } 102 103 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 104 void BlobResourceSynchronousLoader::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace&) 105 { 106 ASSERT_NOT_REACHED(); 107 handle->continueCanAuthenticateAgainstProtectionSpace(false); 108 } 109 #endif 110 111 void BlobResourceSynchronousLoader::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& response) 94 112 { 95 113 // We cannot handle the size that is more than maximum integer. 96 114 if (response.expectedContentLength() > INT_MAX) { 97 115 m_error = ResourceError(webKitBlobResourceDomain, static_cast<int>(BlobResourceHandle::Error::NotReadableError), response.url(), "File is too large"); 116 handle->continueDidReceiveResponse(); 98 117 return; 99 118 } … … 104 123 m_data.resize(static_cast<size_t>(response.expectedContentLength())); 105 124 static_cast<BlobResourceHandle*>(handle)->readSync(m_data.data(), static_cast<int>(m_data.size())); 125 handle->continueDidReceiveResponse(); 106 126 } 107 127 … … 160 180 void BlobResourceHandle::continueDidReceiveResponse() 161 181 { 162 ASSERT(m_async);163 ASSERT(usesAsyncCallbacks());164 165 182 m_buffer.resize(bufferSize); 166 183 readAsync(); … … 229 246 Ref<BlobResourceHandle> protectedThis(*this); 230 247 notifyResponse(); 231 if (!usesAsyncCallbacks()) {232 m_buffer.resize(bufferSize);233 readAsync();234 }235 248 } 236 249 return; … … 423 436 { 424 437 ASSERT(isMainThread()); 425 ASSERT(m_async);426 438 427 439 // Do not continue if the request is aborted or an error occurs. … … 447 459 { 448 460 ASSERT(isMainThread()); 449 ASSERT(m_async);450 461 ASSERT(item.data().data()); 451 462 … … 462 473 { 463 474 ASSERT(isMainThread()); 464 ASSERT(m_async);465 475 466 476 if (m_fileOpened) { … … 576 586 // Notably, this will affect a name suggested in "File Save As". 577 587 578 didReceiveResponse(WTFMove(response));588 client()->didReceiveResponseAsync(this, WTFMove(response)); 579 589 } 580 590 … … 599 609 } 600 610 601 didReceiveResponse(WTFMove(response));611 client()->didReceiveResponseAsync(this, WTFMove(response)); 602 612 } 603 613 -
trunk/Source/WebCore/platform/network/PingHandle.h
r222739 r223271 40 40 WTF_MAKE_NONCOPYABLE(PingHandle); WTF_MAKE_FAST_ALLOCATED; 41 41 public: 42 enum class UsesAsyncCallbacks { 43 Yes, 44 No, 45 }; 46 47 PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, UsesAsyncCallbacks useAsyncCallbacks, bool shouldFollowRedirects, WTF::CompletionHandler<void(const ResourceError&, const ResourceResponse&)>&& completionHandler) 42 PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, bool shouldFollowRedirects, WTF::CompletionHandler<void(const ResourceError&, const ResourceResponse&)>&& completionHandler) 48 43 : m_currentRequest(request) 49 44 , m_timeoutTimer(*this, &PingHandle::timeoutTimerFired) 50 45 , m_shouldUseCredentialStorage(shouldUseCredentialStorage) 51 46 , m_shouldFollowRedirects(shouldFollowRedirects) 52 , m_usesAsyncCallbacks(useAsyncCallbacks)53 47 , m_completionHandler(WTFMove(completionHandler)) 54 48 { … … 61 55 62 56 private: 63 ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&& request, ResourceResponse&&) final 64 { 65 return m_shouldFollowRedirects ? request : ResourceRequest(); 66 } 67 void willSendRequestAsync(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&&) final 57 void willSendRequestAsync(ResourceHandle*, ResourceRequest&& request, ResourceResponse&&) final 68 58 { 69 59 m_currentRequest = WTFMove(request); 70 60 if (m_shouldFollowRedirects) { 71 handle->continueWillSendRequest(ResourceRequest { m_currentRequest });61 m_handle->continueWillSendRequest(ResourceRequest { m_currentRequest }); 72 62 return; 73 63 } 64 m_handle->continueWillSendRequest({ }); 74 65 pingLoadComplete(ResourceError { String(), 0, m_currentRequest.url(), ASCIILiteral("Not allowed to follow redirects"), ResourceError::Type::AccessControl }); 75 66 } 76 void didReceiveResponse(ResourceHandle*, ResourceResponse&& response) final { pingLoadComplete({ }, response); } 67 void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&& response) final 68 { 69 m_handle->continueDidReceiveResponse(); 70 pingLoadComplete({ }, response); 71 } 77 72 void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int) final { pingLoadComplete(); } 78 73 void didFinishLoading(ResourceHandle*) final { pingLoadComplete(); } 79 74 void didFail(ResourceHandle*, const ResourceError& error) final { pingLoadComplete(error); } 80 75 bool shouldUseCredentialStorage(ResourceHandle*) final { return m_shouldUseCredentialStorage; } 81 bool usesAsyncCallbacks() final { return m_usesAsyncCallbacks == UsesAsyncCallbacks::Yes; }82 76 void timeoutTimerFired() { pingLoadComplete(ResourceError { String(), 0, m_currentRequest.url(), ASCIILiteral("Load timed out"), ResourceError::Type::Timeout }); } 77 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 78 void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) 79 { 80 m_handle->continueCanAuthenticateAgainstProtectionSpace(false); 81 delete this; 82 } 83 #endif 83 84 84 85 void pingLoadComplete(const ResourceError& error = { }, const ResourceResponse& response = { }) … … 104 105 bool m_shouldUseCredentialStorage; 105 106 bool m_shouldFollowRedirects; 106 UsesAsyncCallbacks m_usesAsyncCallbacks;107 107 WTF::CompletionHandler<void(const ResourceError&, const ResourceResponse&)> m_completionHandler; 108 108 }; -
trunk/Source/WebCore/platform/network/ResourceHandle.cpp
r222756 r223271 160 160 String message = "Cancelled load from '" + url.stringCenterEllipsizedToLength() + "' because it is using HTTP/0.9."; 161 161 d->m_client->didFail(this, { String(), 0, url, message }); 162 continueDidReceiveResponse(); 162 163 return; 163 164 } 164 165 } 165 if (d->m_usesAsyncCallbacks) 166 d->m_client->didReceiveResponseAsync(this, WTFMove(response)); 167 else { 168 d->m_client->didReceiveResponse(this, WTFMove(response)); 169 platformContinueSynchronousDidReceiveResponse(); 170 } 166 client()->didReceiveResponseAsync(this, WTFMove(response)); 171 167 } 172 168 … … 245 241 } 246 242 247 bool ResourceHandle::usesAsyncCallbacks() const248 {249 return d->m_usesAsyncCallbacks;250 }251 252 243 } // namespace WebCore -
trunk/Source/WebCore/platform/network/ResourceHandle.h
r222467 r223271 71 71 namespace WTF { 72 72 class SchedulePair; 73 template<typename T> class MessageQueue; 73 74 } 74 75 … … 126 127 #if PLATFORM(COCOA) && !USE(CFURLCONNECTION) 127 128 WEBCORE_EXPORT NSURLConnection *connection() const; 128 id makeDelegate(bool );129 id makeDelegate(bool, WTF::MessageQueue<WTF::Function<void()>>*); 129 130 id delegate(); 130 131 void releaseDelegate(); … … 238 239 ResourceHandle(NetworkingContext*, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff); 239 240 240 bool usesAsyncCallbacks() const;241 242 241 private: 243 242 enum FailureType { … … 268 267 269 268 #if USE(CFURLCONNECTION) 270 void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior, CFDictionaryRef clientProperties);269 void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, WTF::MessageQueue<WTF::Function<void()>>*, CFDictionaryRef clientProperties); 271 270 #endif 272 271 -
trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp
r207151 r223271 40 40 { 41 41 } 42 43 ResourceRequest ResourceHandleClient::willSendRequest(ResourceHandle*, ResourceRequest&& request, ResourceResponse&&)44 {45 return WTFMove(request);46 }47 48 void ResourceHandleClient::willSendRequestAsync(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&& /*redirectResponse*/)49 {50 handle->continueWillSendRequest(WTFMove(request));51 }52 53 void ResourceHandleClient::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&&)54 {55 handle->continueDidReceiveResponse();56 }57 58 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)59 void ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace&)60 {61 handle->continueCanAuthenticateAgainstProtectionSpace(false);62 }63 #endif64 42 65 43 #if USE(CFURLCONNECTION) -
trunk/Source/WebCore/platform/network/ResourceHandleClient.h
r215280 r223271 64 64 WEBCORE_EXPORT virtual ~ResourceHandleClient(); 65 65 66 WEBCORE_EXPORT virtual ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&);67 66 virtual void didSendData(ResourceHandle*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } 68 67 69 virtual void didReceiveResponse(ResourceHandle*, ResourceResponse&&) { }70 71 68 virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) { } 72 69 WEBCORE_EXPORT virtual void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength); … … 77 74 virtual void cannotShowURL(ResourceHandle*) { } 78 75 79 virtual bool usesAsyncCallbacks() { return false; }80 81 76 virtual bool loadingSynchronousXHR() { return false; } 82 77 83 78 // Client will pass an updated request using ResourceHandle::continueWillSendRequest() when ready. 84 WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) ;79 WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) = 0; 85 80 86 81 // Client will call ResourceHandle::continueDidReceiveResponse() when ready. 87 WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) ;82 WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) = 0; 88 83 89 84 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 90 85 // Client will pass an updated request using ResourceHandle::continueCanAuthenticateAgainstProtectionSpace() when ready. 91 WEBCORE_EXPORT virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) ;86 WEBCORE_EXPORT virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) = 0; 92 87 #endif 93 88 // Client will pass an updated request using ResourceHandle::continueWillCacheResponse() when ready. … … 104 99 virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; } 105 100 virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { } 106 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)107 virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; }108 #endif109 101 virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { } 110 102 -
trunk/Source/WebCore/platform/network/ResourceHandleInternal.h
r220939 r223271 81 81 , m_defersLoading(defersLoading) 82 82 , m_shouldContentSniff(shouldContentSniff) 83 , m_usesAsyncCallbacks(client && client->usesAsyncCallbacks())84 83 #if USE(CFURLCONNECTION) 85 84 , m_currentRequest(request) … … 116 115 bool m_defersLoading; 117 116 bool m_shouldContentSniff; 118 bool m_usesAsyncCallbacks;119 117 #if USE(CFURLCONNECTION) 120 118 RetainPtr<CFURLConnectionRef> m_connection; -
trunk/Source/WebCore/platform/network/SynchronousLoaderClient.cpp
r212993 r223271 37 37 } 38 38 39 ResourceRequest SynchronousLoaderClient::willSendRequest(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&&)39 void SynchronousLoaderClient::willSendRequestAsync(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&&) 40 40 { 41 41 // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests. 42 if (protocolHostAndPortAreEqual(handle->firstRequest().url(), request.url())) 43 return WTFMove(request); 42 if (protocolHostAndPortAreEqual(handle->firstRequest().url(), request.url())) { 43 handle->continueWillSendRequest(WTFMove(request)); 44 return; 45 } 44 46 45 47 ASSERT(m_error.isNull()); 46 48 m_error = platformBadResponseError(); 47 m_isDone = true; 48 return { }; 49 handle->continueWillSendRequest({ }); 49 50 } 50 51 … … 56 57 57 58 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 58 bool SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&)59 void SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace&) 59 60 { 60 61 // FIXME: We should ask FrameLoaderClient. <http://webkit.org/b/65196> 61 return true;62 handle->continueCanAuthenticateAgainstProtectionSpace(true); 62 63 } 63 64 #endif 64 65 65 void SynchronousLoaderClient::didReceiveResponse (ResourceHandle*, ResourceResponse&& response)66 void SynchronousLoaderClient::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& response) 66 67 { 67 68 m_response = WTFMove(response); 69 handle->continueDidReceiveResponse(); 68 70 } 69 71 … … 75 77 void SynchronousLoaderClient::didFinishLoading(ResourceHandle*) 76 78 { 77 m_ isDone = true;79 m_messageQueue.kill(); 78 80 } 79 81 … … 83 85 84 86 m_error = error; 85 m_isDone = true; 87 88 m_messageQueue.kill(); 86 89 } 87 90 -
trunk/Source/WebCore/platform/network/SynchronousLoaderClient.h
r212993 r223271 24 24 */ 25 25 26 #ifndef SynchronousLoaderClient_h 27 #define SynchronousLoaderClient_h 26 #pragma once 28 27 29 28 #include "ResourceError.h" 30 29 #include "ResourceHandleClient.h" 31 30 #include "ResourceResponse.h" 31 #include <wtf/Function.h> 32 #include <wtf/MessageQueue.h> 32 33 33 34 namespace WebCore { … … 41 42 Vector<char>& mutableData() { return m_data; } 42 43 const ResourceError& error() const { return m_error; } 43 bool isDone() { return m_isDone; }44 MessageQueue<Function<void()>>& messageQueue() { return m_messageQueue; } 44 45 45 46 WEBCORE_EXPORT static ResourceError platformBadResponseError(); 46 47 47 48 private: 48 ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override;49 void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override; 49 50 bool shouldUseCredentialStorage(ResourceHandle*) override; 50 51 void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) override; 51 void didReceiveResponse (ResourceHandle*, ResourceResponse&&) override;52 void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) override; 52 53 void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) override; 53 54 void didFinishLoading(ResourceHandle*) override; 54 55 void didFail(ResourceHandle*, const ResourceError&) override; 55 56 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 56 bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) override;57 void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) override; 57 58 #endif 58 59 … … 61 62 Vector<char> m_data; 62 63 ResourceError m_error; 63 bool m_isDone { false };64 MessageQueue<Function<void()>> m_messageQueue; 64 65 }; 65 66 } 66 67 #endif // SynchronousLoaderClient_h -
trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
r222938 r223271 60 60 }; 61 61 62 #if COMPILER(CLANG) 63 #pragma clang diagnostic push 64 #pragma clang diagnostic ignored "-Wdeprecated-declarations" 65 #endif 62 66 DECLARE_CF_TYPE_TRAIT(CFHTTPCookie); 67 #if COMPILER(CLANG) 68 #pragma clang diagnostic pop 69 #endif 63 70 64 71 #undef DECLARE_CF_TYPE_TRAIT -
trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
r219537 r223271 304 304 305 305 if (kCFCompareEqualTo == CFStringCompare(propertyName, formDataPointerPropertyName, 0)) { 306 long formDataAsNumber = static_cast<long>(reinterpret_cast<intptr_t>(form->formData.get()));307 return CFNumberCreate(0, kCFNumberLong Type, &formDataAsNumber);306 long long formDataAsNumber = static_cast<long long>(reinterpret_cast<intptr_t>(form->formData.get())); 307 return CFNumberCreate(0, kCFNumberLongLongType, &formDataAsNumber); 308 308 } 309 309 -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
r222898 r223271 40 40 #include "NetworkingContext.h" 41 41 #include "ResourceError.h" 42 #include "ResourceHandleCFURLConnectionDelegateWithOperationQueue.h" 42 43 #include "ResourceHandleClient.h" 43 44 #include "ResourceResponse.h" 44 45 #include "SharedBuffer.h" 45 46 #include "SynchronousLoaderClient.h" 46 #include "SynchronousResourceHandleCFURLConnectionDelegate.h"47 47 #include <CFNetwork/CFNetwork.h> 48 48 #include <pal/spi/cf/CFNetworkSPI.h> … … 127 127 } 128 128 129 void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior schedulingBehavior, CFDictionaryRef clientProperties)129 void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, MessageQueue<Function<void()>>* messageQueue, CFDictionaryRef clientProperties) 130 130 { 131 131 if ((!d->m_user.isEmpty() || !d->m_pass.isEmpty()) && !firstRequest().url().protocolIsInHTTPFamily()) { … … 204 204 } 205 205 206 if (schedulingBehavior == SchedulingBehavior::Synchronous) {207 // Synchronous requests should not be subject to regular connection count limit to avoid deadlocks.208 // If we are using all available connections for async requests, and make a sync request, then prior209 // requests may get stuck waiting for delegate calls while we are in nested run loop, and the sync210 // request won't start because there are no available connections.211 // Connections are grouped by their socket stream properties, with each group having a separate count.212 CFDictionarySetValue(streamProperties, CFSTR("_WebKitSynchronousRequest"), kCFBooleanTrue);213 }214 215 206 #if PLATFORM(COCOA) 216 207 RetainPtr<CFDataRef> sourceApplicationAuditData = d->m_context->sourceApplicationAuditData(); … … 238 229 CFRelease(streamProperties); 239 230 240 #if PLATFORM(COCOA) 241 if (d->m_usesAsyncCallbacks) 242 d->m_connectionDelegate = adoptRef(new ResourceHandleCFURLConnectionDelegateWithOperationQueue(this)); 243 else 244 d->m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this)); 245 #else 246 d->m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this)); 247 #endif 231 d->m_connectionDelegate = adoptRef(new ResourceHandleCFURLConnectionDelegateWithOperationQueue(this, messageQueue)); 248 232 d->m_connectionDelegate->setupRequest(request.get()); 249 233 … … 276 260 #endif 277 261 278 SchedulingBehavior schedulingBehavior = client()->loadingSynchronousXHR() ? SchedulingBehavior::Synchronous : SchedulingBehavior::Asynchronous; 279 280 createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, schedulingBehavior, client()->connectionProperties(this).get()); 262 createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, nullptr, client()->connectionProperties(this).get()); 263 ref(); 281 264 282 265 d->m_connectionDelegate->setupConnectionScheduling(d->m_connection.get()); … … 326 309 327 310 Ref<ResourceHandle> protectedThis(*this); 328 if (d->m_usesAsyncCallbacks) { 329 client()->willSendRequestAsync(this, WTFMove(request), WTFMove(redirectResponse)); 330 return { }; 331 } 332 333 auto newRequest = client()->willSendRequest(this, WTFMove(request), WTFMove(redirectResponse)); 334 335 // Client call may not preserve the session, especially if the request is sent over IPC. 336 if (!newRequest.isNull()) { 337 newRequest.setStorageSession(d->m_storageSession.get()); 338 339 d->m_currentRequest = newRequest; 340 } 341 return newRequest; 311 client()->willSendRequestAsync(this, WTFMove(request), WTFMove(redirectResponse)); 312 return { }; 342 313 } 343 314 … … 345 316 { 346 317 LOG(Network, "CFNet - shouldUseCredentialStorage()"); 347 if (ResourceHandleClient* client = this->client()) { 348 ASSERT(!d->m_usesAsyncCallbacks); 318 if (ResourceHandleClient* client = this->client()) 349 319 return client->shouldUseCredentialStorage(this); 350 }351 320 return false; 352 321 } … … 444 413 bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) 445 414 { 446 ResourceHandleClient* client = this->client(); 447 if (d->m_usesAsyncCallbacks) { 448 if (client) 449 client->canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace); 450 else 451 continueCanAuthenticateAgainstProtectionSpace(false); 452 return false; // Ignored by caller. 453 } 454 455 return client && client->canAuthenticateAgainstProtectionSpace(this, protectionSpace); 415 if (auto* client = this->client()) 416 client->canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace); 417 else 418 continueCanAuthenticateAgainstProtectionSpace(false); 419 return false; // Ignored by caller. 456 420 } 457 421 #endif … … 575 539 } 576 540 541 static void emptyPerform(void*) 542 { 543 } 544 577 545 void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentialsPolicy storedCredentialsPolicy, ResourceError& error, ResourceResponse& response, Vector<char>& data) 578 546 { … … 596 564 } 597 565 598 handle->createCFURLConnection(storedCredentialsPolicy == StoredCredentialsPolicy::Use, ResourceHandle::shouldContentSniffURL(request.url()), 599 SchedulingBehavior::Synchronous, handle->client()->connectionProperties(handle.get()).get()); 600 601 CFURLConnectionScheduleWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), synchronousLoadRunLoopMode()); 602 CFURLConnectionScheduleDownloadWithRunLoop(handle->connection(), CFRunLoopGetCurrent(), synchronousLoadRunLoopMode()); 566 handle->ref(); 567 handle->createCFURLConnection(storedCredentialsPolicy == StoredCredentialsPolicy::Use, ResourceHandle::shouldContentSniffURL(request.url()), &client.messageQueue(), handle->client()->connectionProperties(handle.get()).get()); 568 569 static CFRunLoopRef runLoop = nullptr; 570 if (!runLoop) { 571 BinarySemaphore sem; 572 Thread::create("CFNetwork Loader", [&] { 573 runLoop = CFRunLoopGetCurrent(); 574 575 // Must add a source to the run loop to prevent CFRunLoopRun() from exiting. 576 CFRunLoopSourceContext ctxt = { 0, (void*)1 /*must be non-null*/, 0, 0, 0, 0, 0, 0, 0, emptyPerform }; 577 CFRunLoopSourceRef bogusSource = CFRunLoopSourceCreate(0, 0, &ctxt); 578 CFRunLoopAddSource(runLoop, bogusSource, kCFRunLoopDefaultMode); 579 sem.signal(); 580 581 while (true) 582 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1E30, true); 583 }); 584 sem.wait(TimeWithDynamicClockType(WallTime::infinity())); 585 } 586 CFURLConnectionScheduleWithRunLoop(handle->connection(), runLoop, kCFRunLoopDefaultMode); 587 CFURLConnectionScheduleDownloadWithRunLoop(handle->connection(), runLoop, kCFRunLoopDefaultMode); 603 588 CFURLConnectionStart(handle->connection()); 604 589 605 while (!client.isDone()) 606 CFRunLoopRunInMode(synchronousLoadRunLoopMode(), UINT_MAX, true); 590 do { 591 if (auto task = client.messageQueue().waitForMessage()) 592 (*task)(); 593 } while (!client.messageQueue().killed()); 607 594 608 595 error = client.error(); 609 596 610 CFURLConnectionCancel(handle->connection()); 597 if (handle->connection()) 598 CFURLConnectionCancel(handle->connection()); 611 599 612 600 if (error.isNull()) -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
r222898 r223271 32 32 #include "AuthenticationChallenge.h" 33 33 #include "Logging.h" 34 #include "MIMETypeRegistry.h" 34 35 #include "ResourceHandle.h" 35 36 #include "ResourceHandleClient.h" 36 37 #include "ResourceResponse.h" 37 38 #include "SharedBuffer.h" 39 #if !PLATFORM(WIN) 38 40 #include "WebCoreURLResponse.h" 41 #endif 39 42 #include <pal/spi/cf/CFNetworkSPI.h> 40 43 #include <wtf/MainThread.h> 44 #include <wtf/Threading.h> 41 45 #include <wtf/text/CString.h> 42 46 #include <wtf/text/WTFString.h> … … 44 48 namespace WebCore { 45 49 46 ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle* handle )50 ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle* handle, MessageQueue<Function<void()>>* messageQueue) 47 51 : ResourceHandleCFURLConnectionDelegate(handle) 48 , m_queue(dispatch_queue_create("com.apple.WebCore/CFNetwork", DISPATCH_QUEUE_SERIAL)) 49 , m_semaphore(dispatch_semaphore_create(0)) 50 { 51 dispatch_queue_t backgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0); 52 dispatch_set_target_queue(m_queue, backgroundQueue); 52 , m_messageQueue(messageQueue) 53 { 53 54 } 54 55 55 56 ResourceHandleCFURLConnectionDelegateWithOperationQueue::~ResourceHandleCFURLConnectionDelegateWithOperationQueue() 56 57 { 57 dispatch_release(m_semaphore);58 dispatch_release(m_queue);59 58 } 60 59 … … 69 68 m_requestResult = nullptr; 70 69 m_cachedResponseResult = nullptr; 71 m_boolResult = false; 72 dispatch_semaphore_signal(m_semaphore); 70 m_semaphore.signal(); 73 71 } 74 72 … … 84 82 } 85 83 84 #if PLATFORM(WIN) 85 LRESULT CALLBACK hookToRemoveCFNetworkMessage(int code, WPARAM wParam, LPARAM lParam) 86 { 87 MSG* msg = reinterpret_cast<MSG*>(lParam); 88 // This message which CFNetwork sends to itself, will block the main thread, remove it. 89 if (msg->message == WM_USER + 0xcf) 90 msg->message = WM_NULL; 91 return CallNextHookEx(nullptr, code, wParam, lParam); 92 } 93 94 static void installHookToRemoveCFNetworkMessageBlockingMainThread() 95 { 96 static HHOOK hook = nullptr; 97 if (!hook) { 98 DWORD threadID = ::GetCurrentThreadId(); 99 hook = ::SetWindowsHookExW(WH_GETMESSAGE, hookToRemoveCFNetworkMessage, 0, threadID); 100 } 101 } 102 #endif 103 104 static void emptyPerform(void*) 105 { 106 } 107 108 static CFRunLoopRef getRunLoop() 109 { 110 static CFRunLoopRef runLoop = nullptr; 111 112 if (!runLoop) { 113 BinarySemaphore sem; 114 Thread::create("CFNetwork Loader", [&] { 115 runLoop = CFRunLoopGetCurrent(); 116 117 // Must add a source to the run loop to prevent CFRunLoopRun() from exiting. 118 CFRunLoopSourceContext ctxt = { 0, (void*)1 /*must be non-null*/, 0, 0, 0, 0, 0, 0, 0, emptyPerform }; 119 CFRunLoopSourceRef bogusSource = CFRunLoopSourceCreate(0, 0, &ctxt); 120 CFRunLoopAddSource(runLoop, bogusSource, kCFRunLoopDefaultMode); 121 sem.signal(); 122 123 while (true) 124 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1E30, true); 125 }); 126 sem.wait(TimeWithDynamicClockType(WallTime::infinity())); 127 } 128 129 return runLoop; 130 } 131 86 132 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupConnectionScheduling(CFURLConnectionRef connection) 87 133 { 88 CFURLConnectionSetDelegateDispatchQueue(connection, m_queue); 134 #if PLATFORM(WIN) 135 installHookToRemoveCFNetworkMessageBlockingMainThread(); 136 #endif 137 CFRunLoopRef runLoop = getRunLoop(); 138 CFURLConnectionScheduleWithRunLoop(connection, runLoop, kCFRunLoopDefaultMode); 139 CFURLConnectionScheduleDownloadWithRunLoop(connection, runLoop, kCFRunLoopDefaultMode); 89 140 } 90 141 … … 102 153 ASSERT(!isMainThread()); 103 154 104 struct ProtectedParameters { 105 Ref<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protectedThis; 106 RetainPtr<CFURLRequestRef> cfRequest; 107 RetainPtr<CFURLResponseRef> originalRedirectResponse; 108 }; 109 110 auto work = [] (void* context) { 111 auto& parameters = *reinterpret_cast<ProtectedParameters*>(context); 112 auto& protectedThis = parameters.protectedThis; 113 auto& handle = protectedThis->m_handle; 114 auto& cfRequest = parameters.cfRequest; 155 auto work = [protectedThis = makeRef(*this), cfRequest = RetainPtr<CFURLRequestRef>(cfRequest), originalRedirectResponse = RetainPtr<CFURLResponseRef>(originalRedirectResponse)] () { 156 auto& handle = protectedThis->m_handle; 115 157 116 158 if (!protectedThis->hasHandle()) { … … 121 163 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 122 164 123 RetainPtr<CFURLResponseRef> redirectResponse = protectedThis->synthesizeRedirectResponseIfNecessary(cfRequest.get(), parameters.originalRedirectResponse.get());165 RetainPtr<CFURLResponseRef> redirectResponse = protectedThis->synthesizeRedirectResponseIfNecessary(cfRequest.get(), originalRedirectResponse.get()); 124 166 ASSERT(redirectResponse); 125 167 … … 128 170 }; 129 171 130 ProtectedParameters parameters { makeRef(*this), cfRequest, originalRedirectResponse }; 131 dispatch_async_f(dispatch_get_main_queue(), ¶meters, work); 132 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); 172 if (m_messageQueue) 173 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 174 else 175 callOnMainThread(WTFMove(work)); 176 m_semaphore.wait(TimeWithDynamicClockType(WallTime::infinity())); 133 177 134 178 return m_requestResult.leakRef(); … … 137 181 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse) 138 182 { 139 struct ProtectedParameters { 140 Ref<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protectedThis; 141 RetainPtr<CFURLConnectionRef> connection; 142 RetainPtr<CFURLResponseRef> cfResponse; 143 }; 144 145 auto work = [] (void* context) { 146 auto& parameters = *reinterpret_cast<ProtectedParameters*>(context); 147 auto& protectedThis = parameters.protectedThis; 148 auto& handle = protectedThis->m_handle; 149 auto& cfResponse = parameters.cfResponse; 150 151 if (!protectedThis->hasHandle() || !handle->client()) { 183 auto work = [protectedThis = makeRef(*this), cfResponse = RetainPtr<CFURLResponseRef>(cfResponse), connection = RetainPtr<CFURLConnectionRef>(connection)] () { 184 auto& handle = protectedThis->m_handle; 185 186 if (!protectedThis->hasHandle() || !handle->client() || !handle->connection()) { 152 187 protectedThis->continueDidReceiveResponse(); 153 188 return; … … 162 197 if (statusCode != 304) { 163 198 bool isMainResourceLoad = handle->firstRequest().requester() == ResourceRequest::Requester::Main; 199 #if !PLATFORM(WIN) 164 200 adjustMIMETypeIfNecessary(cfResponse.get(), isMainResourceLoad); 201 #endif 165 202 } 166 203 … … 171 208 172 209 ResourceResponse resourceResponse(cfResponse.get()); 173 ResourceHandle::getConnectionTimingData(parameters.connection.get(), resourceResponse.deprecatedNetworkLoadMetrics()); 210 resourceResponse.setSource(ResourceResponse::Source::Network); 211 #if !PLATFORM(WIN) 212 ResourceHandle::getConnectionTimingData(connection.get(), resourceResponse.deprecatedNetworkLoadMetrics()); 213 #endif 174 214 175 215 handle->didReceiveResponse(WTFMove(resourceResponse)); 176 216 }; 177 217 178 ProtectedParameters parameters { makeRef(*this), connection, cfResponse }; 179 dispatch_async_f(dispatch_get_main_queue(), ¶meters, work); 180 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); 218 if (m_messageQueue) 219 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 220 else 221 callOnMainThread(WTFMove(work)); 222 m_semaphore.wait(TimeWithDynamicClockType(WallTime::infinity())); 181 223 } 182 224 183 225 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData(CFDataRef data, CFIndex originalLength) 184 226 { 185 callOnMainThread([protectedThis = makeRef(*this), data = RetainPtr<CFDataRef>(data), originalLength = originalLength] () mutable { 227 auto work = [protectedThis = makeRef(*this), data = RetainPtr<CFDataRef>(data), originalLength = originalLength] () mutable { 228 auto& handle = protectedThis->m_handle; 229 if (!protectedThis->hasHandle() || !handle->client() || !handle->connection()) 230 return; 231 232 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 233 234 handle->client()->didReceiveBuffer(handle, SharedBuffer::create(data.get()), originalLength); 235 }; 236 237 if (m_messageQueue) 238 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 239 else 240 callOnMainThread(WTFMove(work)); 241 } 242 243 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading() 244 { 245 auto work = [protectedThis = makeRef(*this)] () mutable { 246 auto& handle = protectedThis->m_handle; 247 if (!protectedThis->hasHandle() || !handle->client() || !handle->connection()) { 248 protectedThis->m_handle->deref(); 249 return; 250 } 251 252 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 253 254 handle->client()->didFinishLoading(handle); 255 if (protectedThis->m_messageQueue) { 256 protectedThis->m_messageQueue->kill(); 257 protectedThis->m_messageQueue = nullptr; 258 } 259 protectedThis->m_handle->deref(); 260 }; 261 262 if (m_messageQueue) 263 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 264 else 265 callOnMainThread(WTFMove(work)); 266 } 267 268 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail(CFErrorRef error) 269 { 270 auto work = [protectedThis = makeRef(*this), error = RetainPtr<CFErrorRef>(error)] () mutable { 271 auto& handle = protectedThis->m_handle; 272 if (!protectedThis->hasHandle() || !handle->client() || !handle->connection()) { 273 protectedThis->m_handle->deref(); 274 return; 275 } 276 277 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 278 279 handle->client()->didFail(handle, ResourceError(error.get())); 280 if (protectedThis->m_messageQueue) { 281 protectedThis->m_messageQueue->kill(); 282 protectedThis->m_messageQueue = nullptr; 283 } 284 protectedThis->m_handle->deref(); 285 }; 286 287 if (m_messageQueue) 288 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 289 else 290 callOnMainThread(WTFMove(work)); 291 } 292 293 CFCachedURLResponseRef ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse(CFCachedURLResponseRef cachedResponse) 294 { 295 #if PLATFORM(WIN) 296 // Workaround for <rdar://problem/6300990> Caching does not respect Vary HTTP header. 297 // FIXME: WebCore cache has issues with Vary, too (bug 58797, bug 71509). 298 CFURLResponseRef wrappedResponse = CFCachedURLResponseGetWrappedResponse(cachedResponse); 299 if (CFHTTPMessageRef httpResponse = CFURLResponseGetHTTPResponse(wrappedResponse)) { 300 ASSERT(CFHTTPMessageIsHeaderComplete(httpResponse)); 301 RetainPtr<CFStringRef> varyValue = adoptCF(CFHTTPMessageCopyHeaderFieldValue(httpResponse, CFSTR("Vary"))); 302 if (varyValue) 303 return nullptr; 304 } 305 #endif // PLATFORM(WIN) 306 307 auto work = [protectedThis = makeRef(*this), cachedResponse = RetainPtr<CFCachedURLResponseRef>(cachedResponse)] () { 308 auto& handle = protectedThis->m_handle; 309 310 if (!protectedThis->hasHandle() || !handle->client() || !handle->connection()) { 311 protectedThis->continueWillCacheResponse(nullptr); 312 return; 313 } 314 315 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 316 317 handle->client()->willCacheResponseAsync(handle, cachedResponse.get()); 318 }; 319 320 if (m_messageQueue) 321 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 322 else 323 callOnMainThread(WTFMove(work)); 324 m_semaphore.wait(TimeWithDynamicClockType(WallTime::infinity())); 325 return m_cachedResponseResult.leakRef(); 326 } 327 328 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge(CFURLAuthChallengeRef challenge) 329 { 330 auto work = [protectedThis = makeRef(*this), challenge = RetainPtr<CFURLAuthChallengeRef>(challenge)] () mutable { 331 auto& handle = protectedThis->m_handle; 332 if (!protectedThis->hasHandle()) 333 return; 334 335 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 336 337 handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(challenge.get(), handle)); 338 }; 339 340 if (m_messageQueue) 341 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 342 else 343 callOnMainThread(WTFMove(work)); 344 } 345 346 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) 347 { 348 auto work = [protectedThis = makeRef(*this), totalBytesWritten, totalBytesExpectedToWrite] () mutable { 186 349 auto& handle = protectedThis->m_handle; 187 350 if (!protectedThis->hasHandle() || !handle->client()) 188 351 return; 189 190 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data());191 192 handle->client()->didReceiveBuffer(handle, SharedBuffer::create(data.get()), originalLength);193 });194 }195 196 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading()197 {198 callOnMainThread([protectedThis = makeRef(*this)] () mutable {199 auto& handle = protectedThis->m_handle;200 if (!protectedThis->hasHandle() || !handle->client())201 return;202 203 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data());204 205 handle->client()->didFinishLoading(handle);206 });207 }208 209 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail(CFErrorRef error)210 {211 callOnMainThread([protectedThis = makeRef(*this), error = RetainPtr<CFErrorRef>(error)] () mutable {212 auto& handle = protectedThis->m_handle;213 if (!protectedThis->hasHandle() || !handle->client())214 return;215 216 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data());217 218 handle->client()->didFail(handle, ResourceError(error.get()));219 });220 }221 222 CFCachedURLResponseRef ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse(CFCachedURLResponseRef cachedResponse)223 {224 struct ProtectedParameters {225 Ref<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protectedThis;226 RetainPtr<CFCachedURLResponseRef> cachedResponse;227 };228 229 auto work = [] (void* context) {230 auto& parameters = *reinterpret_cast<ProtectedParameters*>(context);231 auto& protectedThis = parameters.protectedThis;232 auto& handle = protectedThis->m_handle;233 234 if (!protectedThis->hasHandle() || !handle->client()) {235 protectedThis->continueWillCacheResponse(nullptr);236 return;237 }238 239 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data());240 241 handle->client()->willCacheResponseAsync(handle, parameters.cachedResponse.get());242 };243 244 ProtectedParameters parameters { makeRef(*this), cachedResponse };245 dispatch_async_f(dispatch_get_main_queue(), ¶meters, work);246 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);247 return m_cachedResponseResult.leakRef();248 }249 250 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge(CFURLAuthChallengeRef challenge)251 {252 callOnMainThread([protectedThis = makeRef(*this), challenge = RetainPtr<CFURLAuthChallengeRef>(challenge)] () mutable {253 auto& handle = protectedThis->m_handle;254 if (!protectedThis->hasHandle())255 return;256 257 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data());258 259 handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(challenge.get(), handle));260 });261 }262 263 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite)264 {265 callOnMainThread([protectedThis = makeRef(*this), totalBytesWritten, totalBytesExpectedToWrite] () mutable {266 auto& handle = protectedThis->m_handle;267 if (!protectedThis->hasHandle() || !handle->client())268 return;269 352 270 353 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 271 354 272 355 handle->client()->didSendData(handle, totalBytesWritten, totalBytesExpectedToWrite); 273 }); 356 }; 357 358 if (m_messageQueue) 359 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 360 else 361 callOnMainThread(WTFMove(work)); 274 362 } 275 363 276 364 Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage() 277 365 { 278 return NO;366 return false; 279 367 } 280 368 … … 282 370 Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(CFURLProtectionSpaceRef protectionSpace) 283 371 { 284 struct ProtectedParameters { 285 Ref<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protectedThis; 286 RetainPtr<CFURLProtectionSpaceRef> protectionSpace; 287 }; 288 289 auto work = [] (void* context) { 290 auto& parameters = *reinterpret_cast<ProtectedParameters*>(context); 291 auto& protectedThis = parameters.protectedThis; 372 auto work = [protectedThis = makeRef(*this), protectionSpace = RetainPtr<CFURLProtectionSpaceRef>(protectionSpace)] () mutable { 292 373 auto& handle = protectedThis->m_handle; 293 374 … … 299 380 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 300 381 301 ProtectionSpace coreProtectionSpace = ProtectionSpace(p arameters.protectionSpace.get());382 ProtectionSpace coreProtectionSpace = ProtectionSpace(protectionSpace.get()); 302 383 #if PLATFORM(IOS) 303 384 if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown) { … … 310 391 }; 311 392 312 ProtectedParameters parameters { makeRef(*this), protectionSpace }; 313 dispatch_async_f(dispatch_get_main_queue(), ¶meters, work); 314 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); 393 if (m_messageQueue) 394 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 395 else 396 callOnMainThread(WTFMove(work)); 397 m_semaphore.wait(TimeWithDynamicClockType(WallTime::infinity())); 315 398 return m_boolResult; 316 399 } 400 401 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate) 402 { 403 m_boolResult = canAuthenticate; 404 m_semaphore.signal(); 405 } 317 406 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 318 407 … … 320 409 { 321 410 m_requestResult = request; 322 dispatch_semaphore_signal(m_semaphore);411 m_semaphore.signal(); 323 412 } 324 413 325 414 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse() 326 415 { 327 dispatch_semaphore_signal(m_semaphore);416 m_semaphore.signal(); 328 417 } 329 418 … … 331 420 { 332 421 m_cachedResponseResult = response; 333 dispatch_semaphore_signal(m_semaphore); 334 } 335 336 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 337 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate) 338 { 339 m_boolResult = canAuthenticate; 340 dispatch_semaphore_signal(m_semaphore); 341 } 342 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 422 m_semaphore.signal(); 423 } 424 343 425 } // namespace WebCore 344 426 -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h
r215280 r223271 31 31 #include <CFNetwork/CFNetwork.h> 32 32 #include <dispatch/queue.h> 33 #include <dispatch/semaphore.h> 33 #include <wtf/Function.h> 34 #include <wtf/MessageQueue.h> 35 #include <wtf/threads/BinarySemaphore.h> 34 36 35 37 namespace WebCore { … … 37 39 class ResourceHandleCFURLConnectionDelegateWithOperationQueue final : public ResourceHandleCFURLConnectionDelegate { 38 40 public: 39 ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle* );41 ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle*, MessageQueue<Function<void()>>*); 40 42 virtual ~ResourceHandleCFURLConnectionDelegateWithOperationQueue(); 41 43 … … 56 58 void didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) override; 57 59 Boolean shouldUseCredentialStorage() override; 58 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)59 Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override;60 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)61 60 62 61 void continueWillSendRequest(CFURLRequestRef) override; … … 64 63 void continueWillCacheResponse(CFCachedURLResponseRef) override; 65 64 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 65 Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override; 66 66 void continueCanAuthenticateAgainstProtectionSpace(bool) override; 67 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)67 #endif 68 68 69 dispatch_queue_t m_queue;70 dispatch_semaphore_t m_semaphore;69 BinarySemaphore m_semaphore; 70 MessageQueue<Function<void()>>* m_messageQueue { nullptr }; 71 71 72 72 RetainPtr<CFURLRequestRef> m_requestResult; 73 73 RetainPtr<CFCachedURLResponseRef> m_cachedResponseResult; 74 bool m_boolResult ;74 bool m_boolResult { false }; 75 75 }; 76 76 -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
r222898 r223271 180 180 CString utf8String = partition.utf8(); 181 181 RetainPtr<CFStringRef> partitionValue = adoptCF(CFStringCreateWithBytes(0, reinterpret_cast<const UInt8*>(utf8String.data()), utf8String.length(), kCFStringEncodingUTF8, false)); 182 _CFURLRequestSetProtocolProperty(cfRequest, kCFURLCachePartitionKey, partitionValue.get());182 _CFURLRequestSetProtocolProperty(cfRequest, _kCFURLCachePartitionKey, partitionValue.get()); 183 183 } 184 184 #endif … … 292 292 293 293 #if ENABLE(CACHE_PARTITIONING) 294 RetainPtr<CFStringRef> cachePartition = adoptCF(static_cast<CFStringRef>(_CFURLRequestCopyProtocolPropertyForKey(m_cfRequest.get(), kCFURLCachePartitionKey)));294 RetainPtr<CFStringRef> cachePartition = adoptCF(static_cast<CFStringRef>(_CFURLRequestCopyProtocolPropertyForKey(m_cfRequest.get(), _kCFURLCachePartitionKey))); 295 295 if (cachePartition) 296 296 m_cachePartition = cachePartition.get(); -
trunk/Source/WebCore/platform/network/curl/MultipartHandle.cpp
r222397 r223271 351 351 response.setTextEncodingName(extractCharsetFromMediaType(contentType)); 352 352 353 d->client()->didReceiveResponse(m_resourceHandle,WTFMove(response));353 m_resourceHandle->didReceiveResponse(WTFMove(response)); 354 354 } 355 355 } -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
r222756 r223271 277 277 { 278 278 ASSERT(isMainThread()); 279 ASSERT(!client() || client()->usesAsyncCallbacks());280 279 281 280 if (d->m_delegate) -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp
r222828 r223271 364 364 365 365 ResourceResponse responseCopy = response(); 366 if (m_handle->client()->usesAsyncCallbacks()) 367 m_handle->client()->willSendRequestAsync(m_handle, WTFMove(newRequest), WTFMove(responseCopy)); 368 else { 369 auto request = m_handle->client()->willSendRequest(m_handle, WTFMove(newRequest), WTFMove(responseCopy)); 370 continueAfterWillSendRequest(WTFMove(request)); 371 } 366 m_handle->client()->willSendRequestAsync(m_handle, WTFMove(newRequest), WTFMove(responseCopy)); 372 367 } 373 368 … … 445 440 if (base64) { 446 441 data = decodeURLEscapeSequences(data); 447 m_handle-> client()->didReceiveResponse(m_handle,WTFMove(response));442 m_handle->didReceiveResponse(WTFMove(response)); 448 443 449 444 // didReceiveResponse might cause the client to be deleted. … … 456 451 TextEncoding encoding(charset); 457 452 data = decodeURLEscapeSequences(data, encoding); 458 m_handle-> client()->didReceiveResponse(m_handle,WTFMove(response));453 m_handle->didReceiveResponse(WTFMove(response)); 459 454 460 455 // didReceiveResponse might cause the client to be deleted. -
trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm
r222938 r223271 44 44 @end 45 45 46 #endif 47 46 48 namespace WebCore { 49 50 static NSArray *httpCookies(CFHTTPCookieStorageRef cookieStorage) 51 { 52 if (!cookieStorage) 53 return [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]; 54 55 auto cookies = adoptCF(CFHTTPCookieStorageCopyCookies(cookieStorage)); 56 return [NSHTTPCookie _cf2nsCookies:cookies.get()]; 57 } 58 59 static void deleteHTTPCookie(CFHTTPCookieStorageRef cookieStorage, NSHTTPCookie *cookie) 60 { 61 if (!cookieStorage) { 62 [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie]; 63 return; 64 } 65 66 CFHTTPCookieStorageDeleteCookie(cookieStorage, [cookie _GetInternalCFHTTPCookie]); 67 } 68 69 #if !USE(CFURLCONNECTION) 47 70 48 71 static NSArray *httpCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSURL *firstParty, NSURL *url) … … 181 204 } 182 205 183 static NSArray *httpCookies(CFHTTPCookieStorageRef cookieStorage)184 {185 if (!cookieStorage)186 return [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];187 188 auto cookies = adoptCF(CFHTTPCookieStorageCopyCookies(cookieStorage));189 return [NSHTTPCookie _cf2nsCookies:cookies.get()];190 }191 192 206 static void setHTTPCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSArray *cookies, NSURL *url, NSURL *mainDocumentURL) 193 207 { … … 199 213 auto cfCookies = adoptCF([NSHTTPCookie _ns2cfCookies:cookies]); 200 214 CFHTTPCookieStorageSetCookies(cookieStorage, cfCookies.get(), [url _cfurl], [mainDocumentURL _cfurl]); 201 }202 203 static void deleteHTTPCookie(CFHTTPCookieStorageRef cookieStorage, NSHTTPCookie *cookie)204 {205 if (!cookieStorage) {206 [[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];207 return;208 }209 210 CFHTTPCookieStorageDeleteCookie(cookieStorage, [cookie _GetInternalCFHTTPCookie]);211 215 } 212 216 … … 345 349 } 346 350 347 }348 349 351 #endif // !USE(CFURLCONNECTION) 350 351 namespace WebCore {352 352 353 353 void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vector<String>& hostnames) -
trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
r222898 r223271 45 45 #import "SubresourceLoader.h" 46 46 #import "SynchronousLoaderClient.h" 47 #import "WebCoreResourceHandleAsDelegate.h"48 47 #import "WebCoreResourceHandleAsOperationQueueDelegate.h" 49 48 #import "WebCoreURLResponse.h" … … 249 248 #if !PLATFORM(IOS) 250 249 createNSURLConnection( 251 ResourceHandle::makeDelegate(shouldUseCredentialStorage ),250 ResourceHandle::makeDelegate(shouldUseCredentialStorage, nullptr), 252 251 shouldUseCredentialStorage, 253 252 d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled(), … … 255 254 #else 256 255 createNSURLConnection( 257 ResourceHandle::makeDelegate(shouldUseCredentialStorage ),256 ResourceHandle::makeDelegate(shouldUseCredentialStorage, nullptr), 258 257 shouldUseCredentialStorage, 259 258 d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled(), … … 262 261 #endif 263 262 264 bool scheduled = false; 265 if (SchedulePairHashSet* scheduledPairs = d->m_context->scheduledRunLoopPairs()) { 266 SchedulePairHashSet::iterator end = scheduledPairs->end(); 267 for (SchedulePairHashSet::iterator it = scheduledPairs->begin(); it != end; ++it) { 268 if (NSRunLoop *runLoop = (*it)->nsRunLoop()) { 269 [connection() scheduleInRunLoop:runLoop forMode:(NSString *)(*it)->mode()]; 270 scheduled = true; 271 } 272 } 273 } 274 275 if (d->m_usesAsyncCallbacks) { 276 ASSERT(!scheduled); 277 [connection() setDelegateQueue:operationQueueForAsyncClients()]; 278 scheduled = true; 279 } 280 #if PLATFORM(IOS) 281 else { 282 [connection() scheduleInRunLoop:WebThreadNSRunLoop() forMode:NSDefaultRunLoopMode]; 283 scheduled = true; 284 } 285 #endif 286 287 // Start the connection if we did schedule with at least one runloop. 288 // We can't start the connection until we have one runloop scheduled. 289 if (scheduled) 290 [connection() start]; 291 else 292 d->m_startWhenScheduled = true; 263 [connection() setDelegateQueue:operationQueueForAsyncClients()]; 264 [connection() start]; 293 265 294 266 LOG(Network, "Handle %p starting connection %p for %@", this, connection(), firstRequest().nsURLRequest(DoNotUpdateHTTPBody)); … … 331 303 return; 332 304 [d->m_connection.get() scheduleInRunLoop:runLoop forMode:(NSString *)pair.mode()]; 333 if (d->m_startWhenScheduled) {334 [d->m_connection.get() start];335 d->m_startWhenScheduled = false;336 }337 305 } 338 306 … … 345 313 #endif 346 314 347 id ResourceHandle::makeDelegate(bool shouldUseCredentialStorage )315 id ResourceHandle::makeDelegate(bool shouldUseCredentialStorage, MessageQueue<Function<void()>>* queue) 348 316 { 349 317 ASSERT(!d->m_delegate); 350 318 351 319 id <NSURLConnectionDelegate> delegate; 352 if (d->m_usesAsyncCallbacks) { 353 if (shouldUseCredentialStorage) 354 delegate = [[WebCoreResourceHandleAsOperationQueueDelegate alloc] initWithHandle:this]; 355 else 356 delegate = [[WebCoreResourceHandleWithCredentialStorageAsOperationQueueDelegate alloc] initWithHandle:this]; 357 } else 358 delegate = [[WebCoreResourceHandleAsDelegate alloc] initWithHandle:this]; 320 if (shouldUseCredentialStorage) 321 delegate = [[WebCoreResourceHandleAsOperationQueueDelegate alloc] initWithHandle:this messageQueue:queue]; 322 else 323 delegate = [[WebCoreResourceHandleWithCredentialStorageAsOperationQueueDelegate alloc] initWithHandle:this messageQueue:queue]; 359 324 360 325 d->m_delegate = delegate; … … 367 332 { 368 333 if (!d->m_delegate) 369 return makeDelegate(false );334 return makeDelegate(false, nullptr); 370 335 return d->m_delegate.get(); 371 336 } … … 410 375 #if !PLATFORM(IOS) 411 376 handle->createNSURLConnection( 412 handle->makeDelegate(shouldUseCredentialStorage ),377 handle->makeDelegate(shouldUseCredentialStorage, &client.messageQueue()), 413 378 shouldUseCredentialStorage, 414 379 handle->shouldContentSniff() || context->localFileContentSniffingEnabled(), … … 416 381 #else 417 382 handle->createNSURLConnection( 418 handle->makeDelegate(shouldUseCredentialStorage ), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.383 handle->makeDelegate(shouldUseCredentialStorage, &client.messageQueue()), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate. 419 384 shouldUseCredentialStorage, 420 385 handle->shouldContentSniff() || (context && context->localFileContentSniffingEnabled()), … … 423 388 #endif 424 389 425 [handle->connection() s cheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:(NSString *)synchronousLoadRunLoopMode()];390 [handle->connection() setDelegateQueue:operationQueueForAsyncClients()]; 426 391 [handle->connection() start]; 427 392 428 while (!client.isDone()) 429 [[NSRunLoop currentRunLoop] runMode:(NSString *)synchronousLoadRunLoopMode() beforeDate:[NSDate distantFuture]]; 393 do { 394 if (auto task = client.messageQueue().waitForMessage()) 395 (*task)(); 396 } while (!client.messageQueue().killed()); 430 397 431 398 error = client.error(); … … 487 454 } 488 455 489 if (d->m_usesAsyncCallbacks) { 490 client()->willSendRequestAsync(this, WTFMove(request), WTFMove(redirectResponse)); 491 return { }; 492 } 493 494 Ref<ResourceHandle> protectedThis(*this); 495 auto newRequest = client()->willSendRequest(this, WTFMove(request), WTFMove(redirectResponse)); 496 497 // Client call may not preserve the session, especially if the request is sent over IPC. 498 if (!newRequest.isNull()) 499 newRequest.setStorageSession(d->m_storageSession.get()); 500 return newRequest; 456 client()->willSendRequestAsync(this, WTFMove(request), WTFMove(redirectResponse)); 457 return { }; 501 458 } 502 459 503 460 void ResourceHandle::continueWillSendRequest(ResourceRequest&& newRequest) 504 461 { 505 ASSERT(d->m_usesAsyncCallbacks);506 507 462 // Client call may not preserve the session, especially if the request is sent over IPC. 508 463 if (!newRequest.isNull()) … … 513 468 void ResourceHandle::continueDidReceiveResponse() 514 469 { 515 ASSERT(d->m_usesAsyncCallbacks);516 517 470 [delegate() continueDidReceiveResponse]; 518 }519 520 bool ResourceHandle::shouldUseCredentialStorage()521 {522 ASSERT(!d->m_usesAsyncCallbacks);523 return client() && client()->shouldUseCredentialStorage(this);524 471 } 525 472 … … 619 566 bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) 620 567 { 621 ResourceHandleClient* client = this->client(); 622 if (d->m_usesAsyncCallbacks) { 623 if (client) 624 client->canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace); 625 else 626 continueCanAuthenticateAgainstProtectionSpace(false); 627 return false; // Ignored by caller. 628 } 629 630 return client && client->canAuthenticateAgainstProtectionSpace(this, protectionSpace); 568 if (ResourceHandleClient* client = this->client()) 569 client->canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace); 570 else 571 continueCanAuthenticateAgainstProtectionSpace(false); 572 return false; // Ignored by caller. 631 573 } 632 574 633 575 void ResourceHandle::continueCanAuthenticateAgainstProtectionSpace(bool result) 634 576 { 635 ASSERT(d->m_usesAsyncCallbacks);636 637 577 [(id)delegate() continueCanAuthenticateAgainstProtectionSpace:result]; 638 578 } … … 720 660 void ResourceHandle::continueWillCacheResponse(NSCachedURLResponse *response) 721 661 { 722 ASSERT(d->m_usesAsyncCallbacks);723 724 662 [(id)delegate() continueWillCacheResponse:response]; 725 663 } -
trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h
r207585 r223271 28 28 #if !USE(CFURLCONNECTION) 29 29 30 #include "WebCoreResourceHandleAsDelegate.h"31 30 #include <dispatch/dispatch.h> 31 #include <wtf/Function.h> 32 #include <wtf/MessageQueue.h> 32 33 #include <wtf/RetainPtr.h> 33 34 … … 36 37 } 37 38 38 @interface WebCoreResourceHandleAsOperationQueueDelegate : NSObject <NSURLConnectionDelegate , WebCoreResourceLoaderDelegate> {39 @interface WebCoreResourceHandleAsOperationQueueDelegate : NSObject <NSURLConnectionDelegate> { 39 40 WebCore::ResourceHandle* m_handle; 40 41 41 42 // Synchronous delegates on operation queue wait until main thread sends an asynchronous response. 42 43 dispatch_semaphore_t m_semaphore; 44 MessageQueue<Function<void()>>* m_messageQueue; 43 45 RetainPtr<NSURLRequest> m_requestResult; 44 46 RetainPtr<NSCachedURLResponse> m_cachedResponseResult; … … 46 48 } 47 49 48 - (id)initWithHandle:(WebCore::ResourceHandle*)handle; 50 - (void)detachHandle; 51 - (id)initWithHandle:(WebCore::ResourceHandle*)handle messageQueue:(MessageQueue<Function<void()>>*)messageQueue; 49 52 - (void)continueWillSendRequest:(NSURLRequest *)newRequest; 50 53 - (void)continueDidReceiveResponse; 51 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)52 54 - (void)continueCanAuthenticateAgainstProtectionSpace:(BOOL)canAuthenticate; 53 #endif54 55 - (void)continueWillCacheResponse:(NSCachedURLResponse *)response; 55 56 @end -
trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
r220243 r223271 37 37 #import "ResourceResponse.h" 38 38 #import "SharedBuffer.h" 39 #import "SynchronousLoaderClient.h" 39 40 #import "WebCoreURLResponse.h" 40 41 #import <pal/spi/cf/CFNetworkSPI.h> … … 45 46 @implementation WebCoreResourceHandleAsOperationQueueDelegate 46 47 47 - (id)initWithHandle:(ResourceHandle*)handle 48 - (id)initWithHandle:(ResourceHandle*)handle messageQueue:(MessageQueue<Function<void()>>*)messageQueue 48 49 { 49 50 self = [self init]; … … 53 54 m_handle = handle; 54 55 m_semaphore = dispatch_semaphore_create(0); 56 m_messageQueue = messageQueue; 55 57 56 58 return self; … … 114 116 #endif 115 117 116 RetainPtr<id> protector(self); 117 118 dispatch_async(dispatch_get_main_queue(), ^{ 118 auto work = [self = self, protectedSelf = RetainPtr<id>(self), newRequest = RetainPtr<NSURLRequest>(newRequest), redirectResponse = RetainPtr<NSURLResponse>(redirectResponse)] () mutable { 119 119 if (!m_handle) { 120 120 m_requestResult = nullptr; … … 123 123 } 124 124 125 m_handle->willSendRequest(newRequest, redirectResponse); 126 }); 125 m_handle->willSendRequest(newRequest.get(), redirectResponse.get()); 126 }; 127 128 129 if (m_messageQueue) 130 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 131 else 132 dispatch_async(dispatch_get_main_queue(), work); 127 133 128 134 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); … … 137 143 LOG(Network, "Handle %p delegate connection:%p didReceiveAuthenticationChallenge:%p", m_handle, connection, challenge); 138 144 139 dispatch_async(dispatch_get_main_queue(), ^{145 auto work = [self, protectedSelf = RetainPtr<id>(self), challenge = RetainPtr<NSURLAuthenticationChallenge>(challenge)] () mutable { 140 146 if (!m_handle) { 141 [[challenge sender] cancelAuthenticationChallenge:challenge]; 142 return; 143 } 144 m_handle->didReceiveAuthenticationChallenge(core(challenge)); 145 }); 146 } 147 148 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 147 [[challenge sender] cancelAuthenticationChallenge:challenge.get()]; 148 return; 149 } 150 m_handle->didReceiveAuthenticationChallenge(core(challenge.get())); 151 }; 152 153 if (m_messageQueue) 154 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 155 else 156 dispatch_async(dispatch_get_main_queue(), work); 157 } 158 149 159 - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace 150 160 { … … 154 164 LOG(Network, "Handle %p delegate connection:%p canAuthenticateAgainstProtectionSpace:%@://%@:%u realm:%@ method:%@ %@%@", m_handle, connection, [protectionSpace protocol], [protectionSpace host], [protectionSpace port], [protectionSpace realm], [protectionSpace authenticationMethod], [protectionSpace isProxy] ? @"proxy:" : @"", [protectionSpace isProxy] ? [protectionSpace proxyType] : @""); 155 165 156 RetainPtr<id> protector(self); 157 158 dispatch_async(dispatch_get_main_queue(), ^{ 166 auto work = [self = self, protectedSelf = RetainPtr<id>(self), protectionSpace = RetainPtr<NSURLProtectionSpace>(protectionSpace)] () mutable { 159 167 if (!m_handle) { 160 168 m_boolResult = NO; … … 162 170 return; 163 171 } 164 m_handle->canAuthenticateAgainstProtectionSpace(ProtectionSpace(protectionSpace)); 165 }); 166 172 m_handle->canAuthenticateAgainstProtectionSpace(ProtectionSpace(protectionSpace.get())); 173 }; 174 175 if (m_messageQueue) 176 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 177 else 178 dispatch_async(dispatch_get_main_queue(), work); 179 167 180 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); 168 181 return m_boolResult; 169 182 } 170 #endif171 183 172 184 - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)r … … 176 188 LOG(Network, "Handle %p delegate connection:%p didReceiveResponse:%p (HTTP status %d, reported MIMEType '%s')", m_handle, connection, r, [r respondsToSelector:@selector(statusCode)] ? [(id)r statusCode] : 0, [[r MIMEType] UTF8String]); 177 189 178 RetainPtr<id> protector(self); 179 180 dispatch_async(dispatch_get_main_queue(), ^{ 190 auto work = [self = self, protectedSelf = RetainPtr<id>(self), r = RetainPtr<NSURLResponse>(r), connection = RetainPtr<NSURLConnection>(connection)] () mutable { 191 RefPtr<ResourceHandle> protectedHandle(m_handle); 181 192 if (!m_handle || !m_handle->client()) { 182 193 dispatch_semaphore_signal(m_semaphore); … … 194 205 [r _setMIMEType:@"text/html"]; 195 206 196 ResourceResponse resourceResponse(r); 197 ResourceHandle::getConnectionTimingData(connection, resourceResponse.deprecatedNetworkLoadMetrics()); 207 ResourceResponse resourceResponse(r.get()); 208 resourceResponse.setSource(ResourceResponse::Source::Network); 209 ResourceHandle::getConnectionTimingData(connection.get(), resourceResponse.deprecatedNetworkLoadMetrics()); 198 210 199 211 m_handle->didReceiveResponse(WTFMove(resourceResponse)); 200 }); 201 212 }; 213 214 if (m_messageQueue) 215 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 216 else 217 dispatch_async(dispatch_get_main_queue(), work); 218 202 219 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); 203 220 } … … 211 228 LOG(Network, "Handle %p delegate connection:%p didReceiveData:%p lengthReceived:%lld", m_handle, connection, data, lengthReceived); 212 229 213 dispatch_async(dispatch_get_main_queue(), ^{230 auto work = [self = self, protectedSelf = RetainPtr<id>(self), data = RetainPtr<NSData>(data)] () mutable { 214 231 if (!m_handle || !m_handle->client()) 215 232 return; … … 221 238 // -1 means we do not provide any data about transfer size to inspector so it would use 222 239 // Content-Length headers or content size to show transfer size. 223 m_handle->client()->didReceiveBuffer(m_handle, SharedBuffer::create(data), -1); 224 }); 240 m_handle->client()->didReceiveBuffer(m_handle, SharedBuffer::create(data.get()), -1); 241 }; 242 243 if (m_messageQueue) 244 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 245 else 246 dispatch_async(dispatch_get_main_queue(), work); 225 247 } 226 248 … … 233 255 LOG(Network, "Handle %p delegate connection:%p didSendBodyData:%d totalBytesWritten:%d totalBytesExpectedToWrite:%d", m_handle, connection, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); 234 256 235 dispatch_async(dispatch_get_main_queue(), ^{257 auto work = [self = self, protectedSelf = RetainPtr<id>(self), totalBytesWritten = totalBytesWritten, totalBytesExpectedToWrite = totalBytesExpectedToWrite] () mutable { 236 258 if (!m_handle || !m_handle->client()) 237 259 return; 238 260 m_handle->client()->didSendData(m_handle, totalBytesWritten, totalBytesExpectedToWrite); 239 }); 261 }; 262 263 if (m_messageQueue) 264 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 265 else 266 dispatch_async(dispatch_get_main_queue(), work); 240 267 } 241 268 … … 247 274 LOG(Network, "Handle %p delegate connectionDidFinishLoading:%p", m_handle, connection); 248 275 249 dispatch_async(dispatch_get_main_queue(), ^{276 auto task = [self = self, protectedSelf = RetainPtr<id>(self)] () mutable { 250 277 if (!m_handle || !m_handle->client()) 251 278 return; 252 279 253 280 m_handle->client()->didFinishLoading(m_handle); 254 }); 281 if (m_messageQueue) { 282 m_messageQueue->kill(); 283 m_messageQueue = nullptr; 284 } 285 }; 286 287 if (m_messageQueue) 288 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(task))); 289 else 290 dispatch_async(dispatch_get_main_queue(), task); 255 291 } 256 292 … … 262 298 LOG(Network, "Handle %p delegate connection:%p didFailWithError:%@", m_handle, connection, error); 263 299 264 dispatch_async(dispatch_get_main_queue(), ^{300 auto work = [self = self, protectedSelf = RetainPtr<id>(self), error = RetainPtr<NSError>(error)] () mutable { 265 301 if (!m_handle || !m_handle->client()) 266 302 return; 267 303 268 m_handle->client()->didFail(m_handle, error); 269 }); 304 m_handle->client()->didFail(m_handle, error.get()); 305 if (m_messageQueue) { 306 m_messageQueue->kill(); 307 m_messageQueue = nullptr; 308 } 309 }; 310 311 if (m_messageQueue) 312 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 313 else 314 dispatch_async(dispatch_get_main_queue(), work); 270 315 } 271 316 … … 278 323 LOG(Network, "Handle %p delegate connection:%p willCacheResponse:%p", m_handle, connection, cachedResponse); 279 324 280 RetainPtr<id> protector(self); 281 282 dispatch_async(dispatch_get_main_queue(), ^{ 325 auto work = [self = self, protectedSelf = RetainPtr<id>(self), cachedResponse = RetainPtr<NSCachedURLResponse>(cachedResponse)] () mutable { 283 326 if (!m_handle || !m_handle->client()) { 284 327 m_cachedResponseResult = nullptr; … … 287 330 } 288 331 289 m_handle->client()->willCacheResponseAsync(m_handle, cachedResponse); 290 }); 332 m_handle->client()->willCacheResponseAsync(m_handle, cachedResponse.get()); 333 }; 334 335 if (m_messageQueue) 336 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 337 else 338 dispatch_async(dispatch_get_main_queue(), work); 291 339 292 340 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); -
trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r222467 r223271 356 356 357 357 ResourceResponse responseCopy = d->m_response; 358 if (d->client()->usesAsyncCallbacks()) 359 d->client()->willSendRequestAsync(handle, WTFMove(newRequest), WTFMove(responseCopy)); 360 else { 361 auto request = d->client()->willSendRequest(handle, WTFMove(newRequest), WTFMove(responseCopy)); 362 continueAfterWillSendRequest(handle, WTFMove(request)); 363 } 364 358 d->client()->willSendRequestAsync(handle, WTFMove(newRequest), WTFMove(responseCopy)); 365 359 } 366 360 … … 1035 1029 void ResourceHandle::continueWillSendRequest(ResourceRequest&& request) 1036 1030 { 1037 ASSERT(!client() || client()->usesAsyncCallbacks());1038 1031 continueAfterWillSendRequest(this, WTFMove(request)); 1039 1032 } … … 1041 1034 void ResourceHandle::continueDidReceiveResponse() 1042 1035 { 1043 ASSERT(!client() || client()->usesAsyncCallbacks());1044 1036 continueAfterDidReceiveResponse(this); 1045 1037 } -
trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp
r212993 r223271 72 72 } 73 73 74 void BlobDownloadClient::willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) 75 { 76 ASSERT_NOT_REACHED(); 77 } 78 79 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 80 void BlobDownloadClient::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) 81 { 82 ASSERT_NOT_REACHED(); 83 } 84 #endif 85 74 86 void BlobDownloadClient::didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&& buffer, int) 75 87 { -
trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.h
r212993 r223271 50 50 void didFinishLoading(WebCore::ResourceHandle*) final; 51 51 void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) final; 52 bool usesAsyncCallbacks() final { return true; } 52 void willSendRequestAsync(WebCore::ResourceHandle*, WebCore::ResourceRequest&&, WebCore::ResourceResponse&&) final; 53 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 54 void canAuthenticateAgainstProtectionSpaceAsync(WebCore::ResourceHandle*, const WebCore::ProtectionSpace&) final; 55 #endif 53 56 54 57 Download& m_download; -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r223207 r223271 252 252 253 253 // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled. 254 new PingHandle(context.ptr(), loadParameters.request, loadParameters.storedCredentialsPolicy == StoredCredentialsPolicy::Use, PingHandle::UsesAsyncCallbacks::Yes,loadParameters.shouldFollowRedirects, WTFMove(completionHandler));254 new PingHandle(context.ptr(), loadParameters.request, loadParameters.storedCredentialsPolicy == StoredCredentialsPolicy::Use, loadParameters.shouldFollowRedirects, WTFMove(completionHandler)); 255 255 #endif 256 256 } -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.h
r222673 r223271 126 126 void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) final; 127 127 void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) final; 128 bool usesAsyncCallbacks() final { return true; }129 128 bool loadingSynchronousXHR() final { return m_client.get().isSynchronous(); } 130 129 #else -
trunk/Source/WebKit/Shared/mac/ArgumentCodersMac.h
r204668 r223271 24 24 */ 25 25 26 #ifndef ArgumentCodersMac_h 27 #define ArgumentCodersMac_h 26 #pragma once 28 27 28 #include <objc/objc.h> 29 29 #include <wtf/RetainPtr.h> 30 30 … … 94 94 95 95 } // namespace IPC 96 97 #endif // ArgumentCodersMac_h -
trunk/Source/WebKit/Shared/mac/WebCoreArgumentCodersMac.mm
r222896 r223271 174 174 } 175 175 176 static RetainPtr<CFDictionaryRef> createSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull)177 {178 return createSerializableRepresentation([request _CFURLRequest], tokenNull);179 }180 181 static RetainPtr<NSURLRequest> createNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull)182 {183 auto cfRequest = createCFURLRequestFromSerializableRepresentation(representation, tokenNull);184 if (!cfRequest)185 return nullptr;186 187 return adoptNS([[NSURLRequest alloc] _initWithCFURLRequest:cfRequest.get()]);188 }189 190 176 #if USE(CFURLCONNECTION) 191 177 void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const ResourceRequest& resourceRequest) … … 218 204 encoder.encodeEnum(resourceRequest.cachePolicy()); 219 205 } 206 220 207 #else 208 209 static RetainPtr<CFDictionaryRef> createSerializableRepresentation(NSURLRequest *request, CFTypeRef tokenNull) 210 { 211 return createSerializableRepresentation([request _CFURLRequest], tokenNull); 212 } 213 214 static RetainPtr<NSURLRequest> createNSURLRequestFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull) 215 { 216 auto cfRequest = createCFURLRequestFromSerializableRepresentation(representation, tokenNull); 217 if (!cfRequest) 218 return nullptr; 219 220 return adoptNS([[NSURLRequest alloc] _initWithCFURLRequest:cfRequest.get()]); 221 } 222 221 223 void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const ResourceRequest& resourceRequest) 222 224 { -
trunk/Source/WebKitLegacy/ChangeLog
r223149 r223271 1 2017-10-12 Alex Christensen <achristensen@webkit.org> 2 3 Use asynchronous ResourceHandleClient calls for WebKit1 4 https://bugs.webkit.org/show_bug.cgi?id=160677 5 6 Reviewed by Brady Eidson. 7 8 * WebCoreSupport/WebResourceLoadScheduler.cpp: 9 (WebResourceLoadScheduler::createPingHandle): 10 1 11 2017-10-10 Sam Weinig <sam@webkit.org> 2 12 -
trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp
r223149 r223271 364 364 { 365 365 // PingHandle manages its own lifetime, deleting itself when its purpose has been fulfilled. 366 new PingHandle(frame.loader().networkingContext(), request, options.credentials != FetchOptions::Credentials::Omit, PingHandle::UsesAsyncCallbacks::No,options.redirect == FetchOptions::Redirect::Follow, WTFMove(completionHandler));366 new PingHandle(frame.loader().networkingContext(), request, options.credentials != FetchOptions::Credentials::Omit, options.redirect == FetchOptions::Redirect::Follow, WTFMove(completionHandler)); 367 367 } 368 368
Note: See TracChangeset
for help on using the changeset viewer.