Changeset 223408 in webkit
- Timestamp:
- Oct 16, 2017 9:12:18 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 49 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223407 r223408 1 2017-10-16 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r223271. 4 5 This change introduced LayoutTest failures on WK1. 6 7 Reverted changeset: 8 9 "Use asynchronous ResourceHandleClient calls for WebKit1" 10 https://bugs.webkit.org/show_bug.cgi?id=160677 11 https://trac.webkit.org/changeset/223271 12 1 13 2017-10-16 Per Arne Vollan <pvollan@apple.com> 2 14 -
trunk/LayoutTests/TestExpectations
r223340 r223408 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 ]45 42 46 43 fast/shadow-dom/touch-event-on-text-assigned-to-slot.html [ Skip ] … … 441 438 webkit.org/b/169565 imported/w3c/web-platform-tests/cors/status-async.htm [ Failure ] 442 439 webkit.org/b/169565 imported/w3c/web-platform-tests/cors/304.htm [ Failure ] 443 444 # These tests used to have deterministic load delegate callback order before webkit.org/b/160677445 http/tests/svg/svg-use-external.html [ Pass Failure ]446 http/tests/loading/text-content-type-with-binary-extension.html [ Pass Failure ]447 http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-iframe-in-main-frame.html [ Pass Failure ]448 440 449 441 # Tests that are flakey due to unhandled promise rejection error messages … … 785 777 webkit.org/b/140043 js/dom/Promise.html [ Pass Failure ] 786 778 787 webkit.org/b/134550 http/tests/cache/iframe-304-crash.html [ Failure Pass ]788 779 webkit.org/b/141267 http/tests/misc/detached-frame-console.html [ Pass Failure ] 789 780 -
trunk/LayoutTests/platform/gtk/TestExpectations
r223325 r223408 1636 1636 webkit.org/b/36642 fast/replaced/border-radius-clip.html [ Failure Pass Crash ] 1637 1637 1638 webkit.org/b/134550 http/tests/cache/iframe-304-crash.html [ Failure Pass ] 1639 1638 1640 webkit.org/b/134573 media/track/audio-track.html [ Failure Timeout Pass ] 1639 1641 webkit.org/b/134576 media/track/audio/audio-track-mkv-vorbis-language.html [ Failure Timeout Pass ] -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r223271 r223408 447 447 448 448 # HTTP tests that are flaky: 449 http/tests/cache/iframe-304-crash.html [ Failure Pass ] 449 450 http/tests/navigation/forward-and-cancel.html [ Failure Pass ] 450 451 http/tests/security/xss-DENIED-xsl-external-entity-redirect.xml [ Failure Pass ] -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r223324 r223408 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 300 302 # testRunner.setUseDeferredFrameLoading is not implemented. 301 303 webkit.org/b/93980 http/tests/appcache/load-from-appcache-defer-resume-crash.html [ Skip ] -
trunk/LayoutTests/platform/wk2/TestExpectations
r223271 r223408 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 ] 267 268 268 269 # WebKit2 needs to support synchronous creation of about:blank/data:url frames -
trunk/LayoutTests/security/block-test.html
r223271 r223408 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 }78 70 </script> 79 <body onload="makeImage()">71 <body> 80 72 <p>This test attempts to change the src of an IMG tag to all black listed ports to confirm that WebKit returns the 81 73 correct error for them - blocked instead of cannot find. It also tries the FTP ports for exemptions. Due to the 82 74 nature of this test, the results can only be processed automatically via DumpRenderTree 83 75 </p> 76 <img id="testIMG" src="http://255.255.255.255:1/test.jpg" onError="nextBlockedPortTest();"></img> 84 77 </body> 85 78 </html> -
trunk/LayoutTests/svg/in-html/by-reference.html
r223271 r223408 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>16 7 <style type='text/css'> 17 8 * { … … 31 22 <body> 32 23 <div> 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-->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--> 38 29 </div> 39 30 </body> -
trunk/Source/WebCore/ChangeLog
r223406 r223408 1 2017-10-16 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r223271. 4 5 This change introduced LayoutTest failures on WK1. 6 7 Reverted changeset: 8 9 "Use asynchronous ResourceHandleClient calls for WebKit1" 10 https://bugs.webkit.org/show_bug.cgi?id=160677 11 https://trac.webkit.org/changeset/223271 12 1 13 2017-10-16 Alejandro G. Castro <alex@igalia.com> 2 14 -
trunk/Source/WebCore/PlatformAppleWin.cmake
r223271 r223408 61 61 platform/network/cf/ResourceHandleCFNet.cpp 62 62 platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp 63 platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp64 63 platform/network/cf/ResourceRequestCFNet.cpp 65 64 platform/network/cf/ResourceResponseCFNet.cpp 66 65 platform/network/cf/SocketStreamHandleImplCFNet.cpp 67 66 platform/network/cf/SynchronousLoaderClientCFNet.cpp 67 platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 68 68 ) 69 69 -
trunk/Source/WebCore/PlatformMac.cmake
r223271 r223408 563 563 platform/network/mac/SynchronousLoaderClient.mm 564 564 platform/network/mac/UTIUtilities.mm 565 platform/network/mac/WebCoreResourceHandleAsDelegate.mm 565 566 platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 566 567 platform/network/mac/WebCoreURLResponse.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r223406 r223408 1092 1092 26FAE4CC1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */; }; 1093 1093 26FAE4CD1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */; }; 1094 26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */; }; 1095 26FAE4CF1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */; }; 1094 1096 2914E3071CAB5A440049966F /* AccessibilityAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */; }; 1095 1097 2914E3081CAB5A440049966F /* AccessibilityAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */; }; … … 6704 6706 E17B492116A9B8FF001C8839 /* JSTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E17B491F16A9B8FF001C8839 /* JSTransitionEvent.h */; }; 6705 6707 E17B492216A9B8FF001C8839 /* JSTransitionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E17B492016A9B8FF001C8839 /* JSTransitionEvent.cpp */; }; 6708 E180810E16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E180810C16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm */; }; 6709 E180810F16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E180810D16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h */; }; 6706 6710 E180811216FCF42F00B80D07 /* SynchronousLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E180811016FCF42E00B80D07 /* SynchronousLoaderClient.cpp */; }; 6707 6711 E180811616FCF9CB00B80D07 /* SynchronousLoaderClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = E180811416FCF9CB00B80D07 /* SynchronousLoaderClient.mm */; }; … … 8739 8743 26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; }; 8740 8744 26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; }; 8745 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousResourceHandleCFURLConnectionDelegate.cpp; sourceTree = "<group>"; }; 8746 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronousResourceHandleCFURLConnectionDelegate.h; sourceTree = "<group>"; }; 8741 8747 2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityAttachment.cpp; sourceTree = "<group>"; }; 8742 8748 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityAttachment.h; sourceTree = "<group>"; }; … … 15520 15526 E17B491F16A9B8FF001C8839 /* JSTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTransitionEvent.h; sourceTree = "<group>"; }; 15521 15527 E17B492016A9B8FF001C8839 /* JSTransitionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTransitionEvent.cpp; sourceTree = "<group>"; }; 15528 E180810C16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreResourceHandleAsDelegate.mm; sourceTree = "<group>"; }; 15529 E180810D16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreResourceHandleAsDelegate.h; sourceTree = "<group>"; }; 15522 15530 E180811016FCF42E00B80D07 /* SynchronousLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousLoaderClient.cpp; sourceTree = "<group>"; }; 15523 15531 E180811416FCF9CB00B80D07 /* SynchronousLoaderClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SynchronousLoaderClient.mm; sourceTree = "<group>"; }; … … 19582 19590 1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */, 19583 19591 1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */, 19592 E180810D16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h */, 19593 E180810C16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm */, 19584 19594 E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */, 19585 19595 E152551416FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm */, … … 24104 24114 51ABAE1D103C1913008C5260 /* SocketStreamHandleImplCFNet.cpp */, 24105 24115 442ABCD517D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp */, 24116 26FAE4CA1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp */, 24117 26FAE4CB1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h */, 24106 24118 ); 24107 24119 path = cf; … … 30549 30561 517A53461F50C17F00DCDC0A /* SWServerWorker.h in Headers */, 30550 30562 E180811716FCF9CB00B80D07 /* SynchronousLoaderClient.h in Headers */, 30563 26FAE4CF1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.h in Headers */, 30551 30564 0F03C0741884695E00A5F8CA /* SystemMemory.h in Headers */, 30552 30565 5D5975B319635F1100D00878 /* SystemVersion.h in Headers */, … … 30781 30794 DD05FE0D0B8BA3C6009ACDFE /* WebCoreObjCExtras.h in Headers */, 30782 30795 EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */, 30796 E180810F16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.h in Headers */, 30783 30797 E152551516FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h in Headers */, 30784 30798 A14832C7187F66C800DA63A6 /* WebCoreThread.h in Headers */, … … 34354 34368 E180811616FCF9CB00B80D07 /* SynchronousLoaderClient.mm in Sources */, 34355 34369 442ABCD617D9262F00D30715 /* SynchronousLoaderClientCFNet.cpp in Sources */, 34370 26FAE4CE1852E3A5004C8C46 /* SynchronousResourceHandleCFURLConnectionDelegate.cpp in Sources */, 34356 34371 E45390AE0EAFF4B5003695C8 /* SystemMemoryIOS.cpp in Sources */, 34357 34372 5D5975B419635F1100D00878 /* SystemVersion.mm in Sources */, … … 34565 34580 B50F5B810E96CD9900AD71A6 /* WebCoreObjCExtras.mm in Sources */, 34566 34581 9BDD18271F7E05F400E8E577 /* WebCorePasteboardFileReader.cpp in Sources */, 34582 E180810E16FCECDF00B80D07 /* WebCoreResourceHandleAsDelegate.mm in Sources */, 34567 34583 E152551616FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.mm in Sources */, 34568 34584 A14832C8187F673F00DA63A6 /* WebCoreThread.mm in Sources */, -
trunk/Source/WebCore/editing/cocoa/WebArchiveResourceFromNSAttributedString.mm
r223271 r223408 43 43 } 44 44 45 resource = ArchiveResource::create(SharedBuffer::create(adoptNS([data copy]).get()), URL, MIMEType, textEncodingName, frameName, { });45 resource = ArchiveResource::create(SharedBuffer::create(adoptNS([data copy]).get()), URL, MIMEType, textEncodingName, frameName, nil); 46 46 if (!resource) { 47 47 [self release]; -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r223271 r223408 619 619 } 620 620 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 } 621 ResourceRequest ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest&& request, ResourceResponse&& redirectResponse) 622 { 623 if (documentLoader()->applicationCacheHost().maybeLoadFallbackForRedirect(this, request, redirectResponse)) 624 return WTFMove(request); 628 625 willSendRequestInternal(request, redirectResponse); 629 handle->continueWillSendRequest(WTFMove(request));626 return WTFMove(request); 630 627 } 631 628 … … 635 632 } 636 633 637 void ResourceLoader::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& response) 638 { 639 if (documentLoader()->applicationCacheHost().maybeLoadFallbackForResponse(this, response)) { 640 handle->continueDidReceiveResponse(); 641 return; 642 } 634 void ResourceLoader::didReceiveResponse(ResourceHandle*, ResourceResponse&& response) 635 { 636 if (documentLoader()->applicationCacheHost().maybeLoadFallbackForResponse(this, response)) 637 return; 643 638 didReceiveResponse(response); 644 handle->continueDidReceiveResponse();645 639 } 646 640 … … 713 707 714 708 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 715 void ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace& protectionSpace)716 {717 handle->continueCanAuthenticateAgainstProtectionSpace(canAuthenticateAgainstProtectionSpace(protectionSpace));718 }719 709 720 710 bool ResourceLoader::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) -
trunk/Source/WebCore/loader/ResourceLoader.h
r223271 r223408 185 185 186 186 // ResourceHandleClient 187 ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&& redirectResponse) override; 187 188 void didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; 188 void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) override; 189 void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override; 189 void didReceiveResponse(ResourceHandle*, 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 void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) override;199 bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace& protectionSpace) override { return canAuthenticateAgainstProtectionSpace(protectionSpace); } 200 200 #endif 201 201 void receivedCancellation(ResourceHandle*, const AuthenticationChallenge& challenge) override { receivedCancellation(challenge); } -
trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
r223271 r223408 486 486 } 487 487 488 void ApplicationCacheGroup::didReceiveResponse Async(ResourceHandle* handle, ResourceResponse&& response)488 void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, ResourceResponse&& response) 489 489 { 490 490 ASSERT(m_frame); … … 493 493 if (handle == m_manifestHandle) { 494 494 didReceiveManifestResponse(response); 495 handle->continueDidReceiveResponse();496 495 return; 497 496 } … … 520 519 // Load the next resource, if any. 521 520 startLoadingEntry(); 522 handle->continueDidReceiveResponse();523 521 return; 524 522 } … … 552 550 startLoadingEntry(); 553 551 } 554 handle->continueDidReceiveResponse();555 552 return; 556 553 } 557 554 558 555 m_currentResource = ApplicationCacheResource::create(url, response, type); 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 556 } 573 557 574 558 void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* data, unsigned length, int encodedDataLength) -
trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.h
r223271 r223408 110 110 111 111 // ResourceHandleClient 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; 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; 120 116 121 117 void didReceiveManifestResponse(const ResourceResponse&); -
trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp
r223271 r223408 75 75 BlobResourceSynchronousLoader(ResourceError&, ResourceResponse&, Vector<char>&); 76 76 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 77 void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override; 78 void didFail(ResourceHandle*, const ResourceError&) override; 83 79 84 80 private: … … 95 91 } 96 92 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) 93 void BlobResourceSynchronousLoader::didReceiveResponse(ResourceHandle* handle, ResourceResponse&& response) 112 94 { 113 95 // We cannot handle the size that is more than maximum integer. 114 96 if (response.expectedContentLength() > INT_MAX) { 115 97 m_error = ResourceError(webKitBlobResourceDomain, static_cast<int>(BlobResourceHandle::Error::NotReadableError), response.url(), "File is too large"); 116 handle->continueDidReceiveResponse();117 98 return; 118 99 } … … 123 104 m_data.resize(static_cast<size_t>(response.expectedContentLength())); 124 105 static_cast<BlobResourceHandle*>(handle)->readSync(m_data.data(), static_cast<int>(m_data.size())); 125 handle->continueDidReceiveResponse();126 106 } 127 107 … … 180 160 void BlobResourceHandle::continueDidReceiveResponse() 181 161 { 162 ASSERT(m_async); 163 ASSERT(usesAsyncCallbacks()); 164 182 165 m_buffer.resize(bufferSize); 183 166 readAsync(); … … 246 229 Ref<BlobResourceHandle> protectedThis(*this); 247 230 notifyResponse(); 231 if (!usesAsyncCallbacks()) { 232 m_buffer.resize(bufferSize); 233 readAsync(); 234 } 248 235 } 249 236 return; … … 436 423 { 437 424 ASSERT(isMainThread()); 425 ASSERT(m_async); 438 426 439 427 // Do not continue if the request is aborted or an error occurs. … … 459 447 { 460 448 ASSERT(isMainThread()); 449 ASSERT(m_async); 461 450 ASSERT(item.data().data()); 462 451 … … 473 462 { 474 463 ASSERT(isMainThread()); 464 ASSERT(m_async); 475 465 476 466 if (m_fileOpened) { … … 586 576 // Notably, this will affect a name suggested in "File Save As". 587 577 588 client()->didReceiveResponseAsync(this,WTFMove(response));578 didReceiveResponse(WTFMove(response)); 589 579 } 590 580 … … 609 599 } 610 600 611 client()->didReceiveResponseAsync(this,WTFMove(response));601 didReceiveResponse(WTFMove(response)); 612 602 } 613 603 -
trunk/Source/WebCore/platform/network/PingHandle.h
r223271 r223408 40 40 WTF_MAKE_NONCOPYABLE(PingHandle); WTF_MAKE_FAST_ALLOCATED; 41 41 public: 42 PingHandle(NetworkingContext* networkingContext, const ResourceRequest& request, bool shouldUseCredentialStorage, bool shouldFollowRedirects, WTF::CompletionHandler<void(const ResourceError&, const ResourceResponse&)>&& completionHandler) 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) 43 48 : m_currentRequest(request) 44 49 , m_timeoutTimer(*this, &PingHandle::timeoutTimerFired) 45 50 , m_shouldUseCredentialStorage(shouldUseCredentialStorage) 46 51 , m_shouldFollowRedirects(shouldFollowRedirects) 52 , m_usesAsyncCallbacks(useAsyncCallbacks) 47 53 , m_completionHandler(WTFMove(completionHandler)) 48 54 { … … 55 61 56 62 private: 57 void willSendRequestAsync(ResourceHandle*, ResourceRequest&& request, ResourceResponse&&) final 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 58 68 { 59 69 m_currentRequest = WTFMove(request); 60 70 if (m_shouldFollowRedirects) { 61 m_handle->continueWillSendRequest(ResourceRequest { m_currentRequest });71 handle->continueWillSendRequest(ResourceRequest { m_currentRequest }); 62 72 return; 63 73 } 64 m_handle->continueWillSendRequest({ });65 74 pingLoadComplete(ResourceError { String(), 0, m_currentRequest.url(), ASCIILiteral("Not allowed to follow redirects"), ResourceError::Type::AccessControl }); 66 75 } 67 void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&& response) final 68 { 69 m_handle->continueDidReceiveResponse(); 70 pingLoadComplete({ }, response); 71 } 76 void didReceiveResponse(ResourceHandle*, ResourceResponse&& response) final { pingLoadComplete({ }, response); } 72 77 void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int) final { pingLoadComplete(); } 73 78 void didFinishLoading(ResourceHandle*) final { pingLoadComplete(); } 74 79 void didFail(ResourceHandle*, const ResourceError& error) final { pingLoadComplete(error); } 75 80 bool shouldUseCredentialStorage(ResourceHandle*) final { return m_shouldUseCredentialStorage; } 81 bool usesAsyncCallbacks() final { return m_usesAsyncCallbacks == UsesAsyncCallbacks::Yes; } 76 82 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 #endif84 83 85 84 void pingLoadComplete(const ResourceError& error = { }, const ResourceResponse& response = { }) … … 105 104 bool m_shouldUseCredentialStorage; 106 105 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
r223271 r223408 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();163 162 return; 164 163 } 165 164 } 166 client()->didReceiveResponseAsync(this, WTFMove(response)); 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 } 167 171 } 168 172 … … 241 245 } 242 246 247 bool ResourceHandle::usesAsyncCallbacks() const 248 { 249 return d->m_usesAsyncCallbacks; 250 } 251 243 252 } // namespace WebCore -
trunk/Source/WebCore/platform/network/ResourceHandle.h
r223271 r223408 71 71 namespace WTF { 72 72 class SchedulePair; 73 template<typename T> class MessageQueue;74 73 } 75 74 … … 127 126 #if PLATFORM(COCOA) && !USE(CFURLCONNECTION) 128 127 WEBCORE_EXPORT NSURLConnection *connection() const; 129 id makeDelegate(bool , WTF::MessageQueue<WTF::Function<void()>>*);128 id makeDelegate(bool); 130 129 id delegate(); 131 130 void releaseDelegate(); … … 239 238 ResourceHandle(NetworkingContext*, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff); 240 239 240 bool usesAsyncCallbacks() const; 241 241 242 private: 242 243 enum FailureType { … … 267 268 268 269 #if USE(CFURLCONNECTION) 269 void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, WTF::MessageQueue<WTF::Function<void()>>*, CFDictionaryRef clientProperties);270 void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior, CFDictionaryRef clientProperties); 270 271 #endif 271 272 -
trunk/Source/WebCore/platform/network/ResourceHandleClient.cpp
r223271 r223408 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 #endif 42 64 43 65 #if USE(CFURLCONNECTION) -
trunk/Source/WebCore/platform/network/ResourceHandleClient.h
r223271 r223408 64 64 WEBCORE_EXPORT virtual ~ResourceHandleClient(); 65 65 66 WEBCORE_EXPORT virtual ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&); 66 67 virtual void didSendData(ResourceHandle*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } 67 68 69 virtual void didReceiveResponse(ResourceHandle*, ResourceResponse&&) { } 70 68 71 virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) { } 69 72 WEBCORE_EXPORT virtual void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength); … … 74 77 virtual void cannotShowURL(ResourceHandle*) { } 75 78 79 virtual bool usesAsyncCallbacks() { return false; } 80 76 81 virtual bool loadingSynchronousXHR() { return false; } 77 82 78 83 // Client will pass an updated request using ResourceHandle::continueWillSendRequest() when ready. 79 WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) = 0;84 WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&); 80 85 81 86 // Client will call ResourceHandle::continueDidReceiveResponse() when ready. 82 WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&) = 0;87 WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&); 83 88 84 89 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 85 90 // Client will pass an updated request using ResourceHandle::continueCanAuthenticateAgainstProtectionSpace() when ready. 86 WEBCORE_EXPORT virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) = 0;91 WEBCORE_EXPORT virtual void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&); 87 92 #endif 88 93 // Client will pass an updated request using ResourceHandle::continueWillCacheResponse() when ready. … … 99 104 virtual bool shouldUseCredentialStorage(ResourceHandle*) { return false; } 100 105 virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { } 106 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 107 virtual bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) { return false; } 108 #endif 101 109 virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { } 102 110 -
trunk/Source/WebCore/platform/network/ResourceHandleInternal.h
r223271 r223408 81 81 , m_defersLoading(defersLoading) 82 82 , m_shouldContentSniff(shouldContentSniff) 83 , m_usesAsyncCallbacks(client && client->usesAsyncCallbacks()) 83 84 #if USE(CFURLCONNECTION) 84 85 , m_currentRequest(request) … … 115 116 bool m_defersLoading; 116 117 bool m_shouldContentSniff; 118 bool m_usesAsyncCallbacks; 117 119 #if USE(CFURLCONNECTION) 118 120 RetainPtr<CFURLConnectionRef> m_connection; -
trunk/Source/WebCore/platform/network/SynchronousLoaderClient.cpp
r223271 r223408 37 37 } 38 38 39 void SynchronousLoaderClient::willSendRequestAsync(ResourceHandle* handle, ResourceRequest&& request, ResourceResponse&&)39 ResourceRequest SynchronousLoaderClient::willSendRequest(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 handle->continueWillSendRequest(WTFMove(request)); 44 return; 45 } 42 if (protocolHostAndPortAreEqual(handle->firstRequest().url(), request.url())) 43 return WTFMove(request); 46 44 47 45 ASSERT(m_error.isNull()); 48 46 m_error = platformBadResponseError(); 49 handle->continueWillSendRequest({ }); 47 m_isDone = true; 48 return { }; 50 49 } 51 50 … … 57 56 58 57 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 59 void SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace&)58 bool SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) 60 59 { 61 60 // FIXME: We should ask FrameLoaderClient. <http://webkit.org/b/65196> 62 handle->continueCanAuthenticateAgainstProtectionSpace(true);61 return true; 63 62 } 64 63 #endif 65 64 66 void SynchronousLoaderClient::didReceiveResponse Async(ResourceHandle* handle, ResourceResponse&& response)65 void SynchronousLoaderClient::didReceiveResponse(ResourceHandle*, ResourceResponse&& response) 67 66 { 68 67 m_response = WTFMove(response); 69 handle->continueDidReceiveResponse();70 68 } 71 69 … … 77 75 void SynchronousLoaderClient::didFinishLoading(ResourceHandle*) 78 76 { 79 m_ messageQueue.kill();77 m_isDone = true; 80 78 } 81 79 … … 85 83 86 84 m_error = error; 87 88 m_messageQueue.kill(); 85 m_isDone = true; 89 86 } 90 87 -
trunk/Source/WebCore/platform/network/SynchronousLoaderClient.h
r223271 r223408 24 24 */ 25 25 26 #pragma once 26 #ifndef SynchronousLoaderClient_h 27 #define SynchronousLoaderClient_h 27 28 28 29 #include "ResourceError.h" 29 30 #include "ResourceHandleClient.h" 30 31 #include "ResourceResponse.h" 31 #include <wtf/Function.h>32 #include <wtf/MessageQueue.h>33 32 34 33 namespace WebCore { … … 42 41 Vector<char>& mutableData() { return m_data; } 43 42 const ResourceError& error() const { return m_error; } 44 MessageQueue<Function<void()>>& messageQueue() { return m_messageQueue; }43 bool isDone() { return m_isDone; } 45 44 46 45 WEBCORE_EXPORT static ResourceError platformBadResponseError(); 47 46 48 47 private: 49 void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override;48 ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override; 50 49 bool shouldUseCredentialStorage(ResourceHandle*) override; 51 50 void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) override; 52 void didReceiveResponse Async(ResourceHandle*, ResourceResponse&&) override;51 void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override; 53 52 void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) override; 54 53 void didFinishLoading(ResourceHandle*) override; 55 54 void didFail(ResourceHandle*, const ResourceError&) override; 56 55 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 57 void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&) override;56 bool canAuthenticateAgainstProtectionSpace(ResourceHandle*, const ProtectionSpace&) override; 58 57 #endif 59 58 … … 62 61 Vector<char> m_data; 63 62 ResourceError m_error; 64 MessageQueue<Function<void()>> m_messageQueue;63 bool m_isDone { false }; 65 64 }; 66 65 } 66 67 #endif // SynchronousLoaderClient_h -
trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
r223271 r223408 60 60 }; 61 61 62 #if COMPILER(CLANG)63 #pragma clang diagnostic push64 #pragma clang diagnostic ignored "-Wdeprecated-declarations"65 #endif66 62 DECLARE_CF_TYPE_TRAIT(CFHTTPCookie); 67 #if COMPILER(CLANG)68 #pragma clang diagnostic pop69 #endif70 63 71 64 #undef DECLARE_CF_TYPE_TRAIT -
trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
r223271 r223408 304 304 305 305 if (kCFCompareEqualTo == CFStringCompare(propertyName, formDataPointerPropertyName, 0)) { 306 long long formDataAsNumber = static_cast<longlong>(reinterpret_cast<intptr_t>(form->formData.get()));307 return CFNumberCreate(0, kCFNumberLong LongType, &formDataAsNumber);306 long formDataAsNumber = static_cast<long>(reinterpret_cast<intptr_t>(form->formData.get())); 307 return CFNumberCreate(0, kCFNumberLongType, &formDataAsNumber); 308 308 } 309 309 -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
r223271 r223408 40 40 #include "NetworkingContext.h" 41 41 #include "ResourceError.h" 42 #include "ResourceHandleCFURLConnectionDelegateWithOperationQueue.h"43 42 #include "ResourceHandleClient.h" 44 43 #include "ResourceResponse.h" 45 44 #include "SharedBuffer.h" 46 45 #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, MessageQueue<Function<void()>>* messageQueue, CFDictionaryRef clientProperties)129 void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior schedulingBehavior, 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 prior 209 // requests may get stuck waiting for delegate calls while we are in nested run loop, and the sync 210 // 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 206 215 #if PLATFORM(COCOA) 207 216 RetainPtr<CFDataRef> sourceApplicationAuditData = d->m_context->sourceApplicationAuditData(); … … 229 238 CFRelease(streamProperties); 230 239 231 d->m_connectionDelegate = adoptRef(new ResourceHandleCFURLConnectionDelegateWithOperationQueue(this, messageQueue)); 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 232 248 d->m_connectionDelegate->setupRequest(request.get()); 233 249 … … 260 276 #endif 261 277 262 createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, nullptr, client()->connectionProperties(this).get()); 263 ref(); 278 SchedulingBehavior schedulingBehavior = client()->loadingSynchronousXHR() ? SchedulingBehavior::Synchronous : SchedulingBehavior::Asynchronous; 279 280 createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, schedulingBehavior, client()->connectionProperties(this).get()); 264 281 265 282 d->m_connectionDelegate->setupConnectionScheduling(d->m_connection.get()); … … 309 326 310 327 Ref<ResourceHandle> protectedThis(*this); 311 client()->willSendRequestAsync(this, WTFMove(request), WTFMove(redirectResponse)); 312 return { }; 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; 313 342 } 314 343 … … 316 345 { 317 346 LOG(Network, "CFNet - shouldUseCredentialStorage()"); 318 if (ResourceHandleClient* client = this->client()) 347 if (ResourceHandleClient* client = this->client()) { 348 ASSERT(!d->m_usesAsyncCallbacks); 319 349 return client->shouldUseCredentialStorage(this); 350 } 320 351 return false; 321 352 } … … 413 444 bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) 414 445 { 415 if (auto* client = this->client()) 416 client->canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace); 417 else 418 continueCanAuthenticateAgainstProtectionSpace(false); 419 return false; // Ignored by caller. 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); 420 456 } 421 457 #endif … … 539 575 } 540 576 541 static void emptyPerform(void*)542 {543 }544 545 577 void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentialsPolicy storedCredentialsPolicy, ResourceError& error, ResourceResponse& response, Vector<char>& data) 546 578 { … … 564 596 } 565 597 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); 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()); 588 603 CFURLConnectionStart(handle->connection()); 589 604 590 do { 591 if (auto task = client.messageQueue().waitForMessage()) 592 (*task)(); 593 } while (!client.messageQueue().killed()); 605 while (!client.isDone()) 606 CFRunLoopRunInMode(synchronousLoadRunLoopMode(), UINT_MAX, true); 594 607 595 608 error = client.error(); 596 609 597 if (handle->connection()) 598 CFURLConnectionCancel(handle->connection()); 610 CFURLConnectionCancel(handle->connection()); 599 611 600 612 if (error.isNull()) -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
r223309 r223408 32 32 #include "AuthenticationChallenge.h" 33 33 #include "Logging.h" 34 #include "MIMETypeRegistry.h"35 34 #include "ResourceHandle.h" 36 35 #include "ResourceHandleClient.h" 37 36 #include "ResourceResponse.h" 38 37 #include "SharedBuffer.h" 39 #if !PLATFORM(WIN)40 38 #include "WebCoreURLResponse.h" 41 #endif42 39 #include <pal/spi/cf/CFNetworkSPI.h> 43 40 #include <wtf/MainThread.h> 44 #include <wtf/Threading.h>45 41 #include <wtf/text/CString.h> 46 42 #include <wtf/text/WTFString.h> … … 48 44 namespace WebCore { 49 45 50 ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle* handle , MessageQueue<Function<void()>>* messageQueue)46 ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle* handle) 51 47 : ResourceHandleCFURLConnectionDelegate(handle) 52 , m_messageQueue(messageQueue) 53 { 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); 54 53 } 55 54 56 55 ResourceHandleCFURLConnectionDelegateWithOperationQueue::~ResourceHandleCFURLConnectionDelegateWithOperationQueue() 57 56 { 57 dispatch_release(m_semaphore); 58 dispatch_release(m_queue); 58 59 } 59 60 … … 68 69 m_requestResult = nullptr; 69 70 m_cachedResponseResult = nullptr; 70 m_semaphore.signal(); 71 m_boolResult = false; 72 dispatch_semaphore_signal(m_semaphore); 71 73 } 72 74 … … 82 84 } 83 85 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 #endif103 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 132 86 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupConnectionScheduling(CFURLConnectionRef connection) 133 87 { 134 #if PLATFORM(WIN) 135 installHookToRemoveCFNetworkMessageBlockingMainThread(); 136 #endif 137 CFRunLoopRef runLoop = getRunLoop(); 138 CFURLConnectionScheduleWithRunLoop(connection, runLoop, kCFRunLoopDefaultMode); 139 CFURLConnectionScheduleDownloadWithRunLoop(connection, runLoop, kCFRunLoopDefaultMode); 88 CFURLConnectionSetDelegateDispatchQueue(connection, m_queue); 140 89 } 141 90 … … 153 102 ASSERT(!isMainThread()); 154 103 155 auto work = [protectedThis = makeRef(*this), cfRequest = RetainPtr<CFURLRequestRef>(cfRequest), originalRedirectResponse = RetainPtr<CFURLResponseRef>(originalRedirectResponse)] () { 156 auto& handle = protectedThis->m_handle; 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; 157 115 158 116 if (!protectedThis->hasHandle()) { … … 163 121 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 164 122 165 RetainPtr<CFURLResponseRef> redirectResponse = protectedThis->synthesizeRedirectResponseIfNecessary(cfRequest.get(), originalRedirectResponse.get());123 RetainPtr<CFURLResponseRef> redirectResponse = protectedThis->synthesizeRedirectResponseIfNecessary(cfRequest.get(), parameters.originalRedirectResponse.get()); 166 124 ASSERT(redirectResponse); 167 125 … … 170 128 }; 171 129 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())); 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); 177 133 178 134 return m_requestResult.leakRef(); … … 181 137 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse) 182 138 { 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()) { 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()) { 187 152 protectedThis->continueDidReceiveResponse(); 188 153 return; … … 197 162 if (statusCode != 304) { 198 163 bool isMainResourceLoad = handle->firstRequest().requester() == ResourceRequest::Requester::Main; 199 #if !PLATFORM(WIN)200 164 adjustMIMETypeIfNecessary(cfResponse.get(), isMainResourceLoad); 201 #endif202 165 } 203 166 … … 208 171 209 172 ResourceResponse resourceResponse(cfResponse.get()); 210 resourceResponse.setSource(ResourceResponse::Source::Network); 211 #if !PLATFORM(WIN) 212 ResourceHandle::getConnectionTimingData(connection.get(), resourceResponse.deprecatedNetworkLoadMetrics()); 213 #endif 173 ResourceHandle::getConnectionTimingData(parameters.connection.get(), resourceResponse.deprecatedNetworkLoadMetrics()); 214 174 215 175 handle->didReceiveResponse(WTFMove(resourceResponse)); 216 176 }; 217 177 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())); 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); 223 181 } 224 182 225 183 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData(CFDataRef data, CFIndex originalLength) 226 184 { 227 auto work = [protectedThis = makeRef(*this), data = RetainPtr<CFDataRef>(data), originalLength = originalLength] () mutable { 185 callOnMainThread([protectedThis = makeRef(*this), data = RetainPtr<CFDataRef>(data), originalLength = originalLength] () mutable { 186 auto& handle = protectedThis->m_handle; 187 if (!protectedThis->hasHandle() || !handle->client()) 188 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 { 228 266 auto& handle = protectedThis->m_handle; 229 267 if (!protectedThis->hasHandle() || !handle->client() || !handle->connection()) 230 268 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 else240 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 else265 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 else290 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 else323 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 else343 callOnMainThread(WTFMove(work));344 }345 346 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite)347 {348 auto work = [protectedThis = makeRef(*this), totalBytesWritten, totalBytesExpectedToWrite] () mutable {349 auto& handle = protectedThis->m_handle;350 if (!protectedThis->hasHandle() || !handle->client() || !handle->connection())351 return;352 269 353 270 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 354 271 355 272 handle->client()->didSendData(handle, totalBytesWritten, totalBytesExpectedToWrite); 356 }; 357 358 if (m_messageQueue) 359 m_messageQueue->append(std::make_unique<Function<void()>>(WTFMove(work))); 360 else 361 callOnMainThread(WTFMove(work)); 273 }); 362 274 } 363 275 364 276 Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage() 365 277 { 366 return false;278 return NO; 367 279 } 368 280 … … 370 282 Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(CFURLProtectionSpaceRef protectionSpace) 371 283 { 372 auto work = [protectedThis = makeRef(*this), protectionSpace = RetainPtr<CFURLProtectionSpaceRef>(protectionSpace)] () mutable { 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; 373 292 auto& handle = protectedThis->m_handle; 374 293 … … 380 299 LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(handle=%p) (%s)", handle, handle->firstRequest().url().string().utf8().data()); 381 300 382 ProtectionSpace coreProtectionSpace = ProtectionSpace(p rotectionSpace.get());301 ProtectionSpace coreProtectionSpace = ProtectionSpace(parameters.protectionSpace.get()); 383 302 #if PLATFORM(IOS) 384 303 if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown) { … … 391 310 }; 392 311 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())); 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); 398 315 return m_boolResult; 399 316 } 400 317 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 318 319 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest(CFURLRequestRef request) 320 { 321 m_requestResult = request; 322 dispatch_semaphore_signal(m_semaphore); 323 } 324 325 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse() 326 { 327 dispatch_semaphore_signal(m_semaphore); 328 } 329 330 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse(CFCachedURLResponseRef response) 331 { 332 m_cachedResponseResult = response; 333 dispatch_semaphore_signal(m_semaphore); 334 } 335 336 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 401 337 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate) 402 338 { 403 339 m_boolResult = canAuthenticate; 404 m_semaphore.signal();340 dispatch_semaphore_signal(m_semaphore); 405 341 } 406 342 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 407 408 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest(CFURLRequestRef request)409 {410 m_requestResult = request;411 m_semaphore.signal();412 }413 414 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueDidReceiveResponse()415 {416 m_semaphore.signal();417 }418 419 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillCacheResponse(CFCachedURLResponseRef response)420 {421 m_cachedResponseResult = response;422 m_semaphore.signal();423 }424 425 343 } // namespace WebCore 426 344 -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h
r223271 r223408 31 31 #include <CFNetwork/CFNetwork.h> 32 32 #include <dispatch/queue.h> 33 #include <wtf/Function.h> 34 #include <wtf/MessageQueue.h> 35 #include <wtf/threads/BinarySemaphore.h> 33 #include <dispatch/semaphore.h> 36 34 37 35 namespace WebCore { … … 39 37 class ResourceHandleCFURLConnectionDelegateWithOperationQueue final : public ResourceHandleCFURLConnectionDelegate { 40 38 public: 41 ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle* , MessageQueue<Function<void()>>*);39 ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle*); 42 40 virtual ~ResourceHandleCFURLConnectionDelegateWithOperationQueue(); 43 41 … … 58 56 void didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) override; 59 57 Boolean shouldUseCredentialStorage() override; 58 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 59 Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override; 60 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 60 61 61 62 void continueWillSendRequest(CFURLRequestRef) override; … … 63 64 void continueWillCacheResponse(CFCachedURLResponseRef) override; 64 65 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 65 Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override;66 66 void continueCanAuthenticateAgainstProtectionSpace(bool) override; 67 #endif 67 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 68 68 69 BinarySemaphore m_semaphore;70 MessageQueue<Function<void()>>* m_messageQueue { nullptr };69 dispatch_queue_t m_queue; 70 dispatch_semaphore_t m_semaphore; 71 71 72 72 RetainPtr<CFURLRequestRef> m_requestResult; 73 73 RetainPtr<CFCachedURLResponseRef> m_cachedResponseResult; 74 bool m_boolResult { false };74 bool m_boolResult; 75 75 }; 76 76 -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
r223271 r223408 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/cf/SynchronousResourceHandleCFURLConnectionDelegate.h
r223407 r223408 1 1 /* 2 * Copyright (C) 20 13 Apple Inc. All rights reserved.2 * Copyright (C) 2004-2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 30 30 #include "ResourceHandleCFURLConnectionDelegate.h" 31 #include <CFNetwork/CFNetwork.h>32 #include <dispatch/queue.h>33 #include <wtf/Function.h>34 #include <wtf/MessageQueue.h>35 #include <wtf/threads/BinarySemaphore.h>36 31 37 32 namespace WebCore { 38 33 39 class ResourceHandleCFURLConnectionDelegateWithOperationQueue final : public ResourceHandleCFURLConnectionDelegate {34 class SynchronousResourceHandleCFURLConnectionDelegate final : public ResourceHandleCFURLConnectionDelegate { 40 35 public: 41 ResourceHandleCFURLConnectionDelegateWithOperationQueue(ResourceHandle*, MessageQueue<Function<void()>>*); 42 virtual ~ResourceHandleCFURLConnectionDelegateWithOperationQueue(); 36 SynchronousResourceHandleCFURLConnectionDelegate(ResourceHandle*); 37 38 void didReceiveData(CFDataRef, CFIndex originalLength) override; 39 void didFinishLoading() override; 40 void didFail(CFErrorRef) override; 43 41 44 42 private: 45 bool hasHandle() const;46 47 43 void setupRequest(CFMutableURLRequestRef) override; 48 44 void setupConnectionScheduling(CFURLConnectionRef) override; 49 void releaseHandle() override;50 45 51 46 CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef) override; 52 47 void didReceiveResponse(CFURLConnectionRef, CFURLResponseRef) override; 53 void didReceiveData(CFDataRef, CFIndex originalLength) override;54 void didFinishLoading() override;55 void didFail(CFErrorRef) override;56 48 CFCachedURLResponseRef willCacheResponse(CFCachedURLResponseRef) override; 57 49 void didReceiveChallenge(CFURLAuthChallengeRef) override; 58 50 void didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) override; 59 51 Boolean shouldUseCredentialStorage() override; 52 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 53 Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override; 54 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 60 55 61 56 void continueWillSendRequest(CFURLRequestRef) override; … … 63 58 void continueWillCacheResponse(CFCachedURLResponseRef) override; 64 59 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 65 Boolean canRespondToProtectionSpace(CFURLProtectionSpaceRef) override;66 60 void continueCanAuthenticateAgainstProtectionSpace(bool) override; 67 #endif 68 69 BinarySemaphore m_semaphore; 70 MessageQueue<Function<void()>>* m_messageQueue { nullptr }; 71 72 RetainPtr<CFURLRequestRef> m_requestResult; 73 RetainPtr<CFCachedURLResponseRef> m_cachedResponseResult; 74 bool m_boolResult { false }; 61 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK) 75 62 }; 76 63 -
trunk/Source/WebCore/platform/network/curl/MultipartHandle.cpp
r223271 r223408 351 351 response.setTextEncodingName(extractCharsetFromMediaType(contentType)); 352 352 353 m_resourceHandle->didReceiveResponse(WTFMove(response));353 d->client()->didReceiveResponse(m_resourceHandle, WTFMove(response)); 354 354 } 355 355 } -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
r223271 r223408 277 277 { 278 278 ASSERT(isMainThread()); 279 ASSERT(!client() || client()->usesAsyncCallbacks()); 279 280 280 281 if (d->m_delegate) -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp
r223271 r223408 364 364 365 365 ResourceResponse responseCopy = response(); 366 m_handle->client()->willSendRequestAsync(m_handle, WTFMove(newRequest), WTFMove(responseCopy)); 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 } 367 372 } 368 373 … … 440 445 if (base64) { 441 446 data = decodeURLEscapeSequences(data); 442 m_handle-> didReceiveResponse(WTFMove(response));447 m_handle->client()->didReceiveResponse(m_handle, WTFMove(response)); 443 448 444 449 // didReceiveResponse might cause the client to be deleted. … … 451 456 TextEncoding encoding(charset); 452 457 data = decodeURLEscapeSequences(data, encoding); 453 m_handle-> didReceiveResponse(WTFMove(response));458 m_handle->client()->didReceiveResponse(m_handle, WTFMove(response)); 454 459 455 460 // didReceiveResponse might cause the client to be deleted. -
trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm
r223271 r223408 44 44 @end 45 45 46 #endif47 48 46 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)70 47 71 48 static NSArray *httpCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSURL *firstParty, NSURL *url) … … 204 181 } 205 182 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 206 192 static void setHTTPCookiesForURL(CFHTTPCookieStorageRef cookieStorage, NSArray *cookies, NSURL *url, NSURL *mainDocumentURL) 207 193 { … … 213 199 auto cfCookies = adoptCF([NSHTTPCookie _ns2cfCookies:cookies]); 214 200 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]); 215 211 } 216 212 … … 349 345 } 350 346 347 } 348 351 349 #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
r223271 r223408 45 45 #import "SubresourceLoader.h" 46 46 #import "SynchronousLoaderClient.h" 47 #import "WebCoreResourceHandleAsDelegate.h" 47 48 #import "WebCoreResourceHandleAsOperationQueueDelegate.h" 48 49 #import "WebCoreURLResponse.h" … … 248 249 #if !PLATFORM(IOS) 249 250 createNSURLConnection( 250 ResourceHandle::makeDelegate(shouldUseCredentialStorage , nullptr),251 ResourceHandle::makeDelegate(shouldUseCredentialStorage), 251 252 shouldUseCredentialStorage, 252 253 d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled(), … … 254 255 #else 255 256 createNSURLConnection( 256 ResourceHandle::makeDelegate(shouldUseCredentialStorage , nullptr),257 ResourceHandle::makeDelegate(shouldUseCredentialStorage), 257 258 shouldUseCredentialStorage, 258 259 d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled(), … … 261 262 #endif 262 263 263 [connection() setDelegateQueue:operationQueueForAsyncClients()]; 264 [connection() start]; 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; 265 293 266 294 LOG(Network, "Handle %p starting connection %p for %@", this, connection(), firstRequest().nsURLRequest(DoNotUpdateHTTPBody)); … … 303 331 return; 304 332 [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 } 305 337 } 306 338 … … 313 345 #endif 314 346 315 id ResourceHandle::makeDelegate(bool shouldUseCredentialStorage , MessageQueue<Function<void()>>* queue)347 id ResourceHandle::makeDelegate(bool shouldUseCredentialStorage) 316 348 { 317 349 ASSERT(!d->m_delegate); 318 350 319 351 id <NSURLConnectionDelegate> delegate; 320 if (shouldUseCredentialStorage) 321 delegate = [[WebCoreResourceHandleAsOperationQueueDelegate alloc] initWithHandle:this messageQueue:queue]; 322 else 323 delegate = [[WebCoreResourceHandleWithCredentialStorageAsOperationQueueDelegate alloc] initWithHandle:this messageQueue:queue]; 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]; 324 359 325 360 d->m_delegate = delegate; … … 332 367 { 333 368 if (!d->m_delegate) 334 return makeDelegate(false , nullptr);369 return makeDelegate(false); 335 370 return d->m_delegate.get(); 336 371 } … … 375 410 #if !PLATFORM(IOS) 376 411 handle->createNSURLConnection( 377 handle->makeDelegate(shouldUseCredentialStorage , &client.messageQueue()),412 handle->makeDelegate(shouldUseCredentialStorage), 378 413 shouldUseCredentialStorage, 379 414 handle->shouldContentSniff() || context->localFileContentSniffingEnabled(), … … 381 416 #else 382 417 handle->createNSURLConnection( 383 handle->makeDelegate(shouldUseCredentialStorage , &client.messageQueue()), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.418 handle->makeDelegate(shouldUseCredentialStorage), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate. 384 419 shouldUseCredentialStorage, 385 420 handle->shouldContentSniff() || (context && context->localFileContentSniffingEnabled()), … … 388 423 #endif 389 424 390 [handle->connection() s etDelegateQueue:operationQueueForAsyncClients()];425 [handle->connection() scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:(NSString *)synchronousLoadRunLoopMode()]; 391 426 [handle->connection() start]; 392 427 393 do { 394 if (auto task = client.messageQueue().waitForMessage()) 395 (*task)(); 396 } while (!client.messageQueue().killed()); 428 while (!client.isDone()) 429 [[NSRunLoop currentRunLoop] runMode:(NSString *)synchronousLoadRunLoopMode() beforeDate:[NSDate distantFuture]]; 397 430 398 431 error = client.error(); … … 454 487 } 455 488 456 client()->willSendRequestAsync(this, WTFMove(request), WTFMove(redirectResponse)); 457 return { }; 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; 458 501 } 459 502 460 503 void ResourceHandle::continueWillSendRequest(ResourceRequest&& newRequest) 461 504 { 505 ASSERT(d->m_usesAsyncCallbacks); 506 462 507 // Client call may not preserve the session, especially if the request is sent over IPC. 463 508 if (!newRequest.isNull()) … … 468 513 void ResourceHandle::continueDidReceiveResponse() 469 514 { 515 ASSERT(d->m_usesAsyncCallbacks); 516 470 517 [delegate() continueDidReceiveResponse]; 518 } 519 520 bool ResourceHandle::shouldUseCredentialStorage() 521 { 522 ASSERT(!d->m_usesAsyncCallbacks); 523 return client() && client()->shouldUseCredentialStorage(this); 471 524 } 472 525 … … 566 619 bool ResourceHandle::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace) 567 620 { 568 if (ResourceHandleClient* client = this->client()) 569 client->canAuthenticateAgainstProtectionSpaceAsync(this, protectionSpace); 570 else 571 continueCanAuthenticateAgainstProtectionSpace(false); 572 return false; // Ignored by caller. 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); 573 631 } 574 632 575 633 void ResourceHandle::continueCanAuthenticateAgainstProtectionSpace(bool result) 576 634 { 635 ASSERT(d->m_usesAsyncCallbacks); 636 577 637 [(id)delegate() continueCanAuthenticateAgainstProtectionSpace:result]; 578 638 } … … 660 720 void ResourceHandle::continueWillCacheResponse(NSCachedURLResponse *response) 661 721 { 722 ASSERT(d->m_usesAsyncCallbacks); 723 662 724 [(id)delegate() continueWillCacheResponse:response]; 663 725 } -
trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.h
r223407 r223408 24 24 */ 25 25 26 #include "config.h" 27 #include "ResourceHandleClient.h" 28 29 #include "ResourceHandle.h" 30 #include "ResourceRequest.h" 31 #include "SharedBuffer.h" 26 #pragma once 32 27 33 28 namespace WebCore { 34 35 ResourceHandleClient::ResourceHandleClient() 36 { 29 class ResourceHandle; 37 30 } 38 31 39 ResourceHandleClient::~ResourceHandleClient() 40 { 32 @protocol WebCoreResourceLoaderDelegate 33 - (void)detachHandle; 34 @end 35 36 #if !USE(CFURLCONNECTION) 37 38 @interface WebCoreResourceHandleAsDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> { 39 WebCore::ResourceHandle* m_handle; 41 40 } 41 - (id)initWithHandle:(WebCore::ResourceHandle*)handle; 42 @end 42 43 43 #if USE(CFURLCONNECTION) 44 void ResourceHandleClient::willCacheResponseAsync(ResourceHandle* handle, CFCachedURLResponseRef response) 45 { 46 handle->continueWillCacheResponse(response); 47 } 48 #elif PLATFORM(COCOA) 49 void ResourceHandleClient::willCacheResponseAsync(ResourceHandle* handle, NSCachedURLResponse *response) 50 { 51 handle->continueWillCacheResponse(response); 52 } 53 #endif 54 55 void ResourceHandleClient::didReceiveBuffer(ResourceHandle* handle, Ref<SharedBuffer>&& buffer, int encodedDataLength) 56 { 57 didReceiveData(handle, buffer->data(), buffer->size(), encodedDataLength); 58 } 59 60 } 44 #endif // !USE(CFURLCONNECTION) -
trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h
r223271 r223408 28 28 #if !USE(CFURLCONNECTION) 29 29 30 #include "WebCoreResourceHandleAsDelegate.h" 30 31 #include <dispatch/dispatch.h> 31 #include <wtf/Function.h>32 #include <wtf/MessageQueue.h>33 32 #include <wtf/RetainPtr.h> 34 33 … … 37 36 } 38 37 39 @interface WebCoreResourceHandleAsOperationQueueDelegate : NSObject <NSURLConnectionDelegate > {38 @interface WebCoreResourceHandleAsOperationQueueDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> { 40 39 WebCore::ResourceHandle* m_handle; 41 40 42 41 // Synchronous delegates on operation queue wait until main thread sends an asynchronous response. 43 42 dispatch_semaphore_t m_semaphore; 44 MessageQueue<Function<void()>>* m_messageQueue;45 43 RetainPtr<NSURLRequest> m_requestResult; 46 44 RetainPtr<NSCachedURLResponse> m_cachedResponseResult; … … 48 46 } 49 47 50 - (void)detachHandle; 51 - (id)initWithHandle:(WebCore::ResourceHandle*)handle messageQueue:(MessageQueue<Function<void()>>*)messageQueue; 48 - (id)initWithHandle:(WebCore::ResourceHandle*)handle; 52 49 - (void)continueWillSendRequest:(NSURLRequest *)newRequest; 53 50 - (void)continueDidReceiveResponse; 51 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 54 52 - (void)continueCanAuthenticateAgainstProtectionSpace:(BOOL)canAuthenticate; 53 #endif 55 54 - (void)continueWillCacheResponse:(NSCachedURLResponse *)response; 56 55 @end -
trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
r223271 r223408 37 37 #import "ResourceResponse.h" 38 38 #import "SharedBuffer.h" 39 #import "SynchronousLoaderClient.h"40 39 #import "WebCoreURLResponse.h" 41 40 #import <pal/spi/cf/CFNetworkSPI.h> … … 46 45 @implementation WebCoreResourceHandleAsOperationQueueDelegate 47 46 48 - (id)initWithHandle:(ResourceHandle*)handle messageQueue:(MessageQueue<Function<void()>>*)messageQueue47 - (id)initWithHandle:(ResourceHandle*)handle 49 48 { 50 49 self = [self init]; … … 54 53 m_handle = handle; 55 54 m_semaphore = dispatch_semaphore_create(0); 56 m_messageQueue = messageQueue;57 55 58 56 return self; … … 116 114 #endif 117 115 118 auto work = [self = self, protectedSelf = RetainPtr<id>(self), newRequest = RetainPtr<NSURLRequest>(newRequest), redirectResponse = RetainPtr<NSURLResponse>(redirectResponse)] () mutable { 116 RetainPtr<id> protector(self); 117 118 dispatch_async(dispatch_get_main_queue(), ^{ 119 119 if (!m_handle) { 120 120 m_requestResult = nullptr; … … 123 123 } 124 124 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); 125 m_handle->willSendRequest(newRequest, redirectResponse); 126 }); 133 127 134 128 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); … … 143 137 LOG(Network, "Handle %p delegate connection:%p didReceiveAuthenticationChallenge:%p", m_handle, connection, challenge); 144 138 145 auto work = [self, protectedSelf = RetainPtr<id>(self), challenge = RetainPtr<NSURLAuthenticationChallenge>(challenge)] () mutable{139 dispatch_async(dispatch_get_main_queue(), ^{ 146 140 if (!m_handle) { 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 141 [[challenge sender] cancelAuthenticationChallenge:challenge]; 142 return; 143 } 144 m_handle->didReceiveAuthenticationChallenge(core(challenge)); 145 }); 146 } 147 148 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 159 149 - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace 160 150 { … … 164 154 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] : @""); 165 155 166 auto work = [self = self, protectedSelf = RetainPtr<id>(self), protectionSpace = RetainPtr<NSURLProtectionSpace>(protectionSpace)] () mutable { 156 RetainPtr<id> protector(self); 157 158 dispatch_async(dispatch_get_main_queue(), ^{ 167 159 if (!m_handle) { 168 160 m_boolResult = NO; … … 170 162 return; 171 163 } 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 164 m_handle->canAuthenticateAgainstProtectionSpace(ProtectionSpace(protectionSpace)); 165 }); 166 180 167 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); 181 168 return m_boolResult; 182 169 } 170 #endif 183 171 184 172 - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)r … … 188 176 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]); 189 177 190 auto work = [self = self, protectedSelf = RetainPtr<id>(self), r = RetainPtr<NSURLResponse>(r), connection = RetainPtr<NSURLConnection>(connection)] () mutable { 191 RefPtr<ResourceHandle> protectedHandle(m_handle); 178 RetainPtr<id> protector(self); 179 180 dispatch_async(dispatch_get_main_queue(), ^{ 192 181 if (!m_handle || !m_handle->client()) { 193 182 dispatch_semaphore_signal(m_semaphore); … … 205 194 [r _setMIMEType:@"text/html"]; 206 195 207 ResourceResponse resourceResponse(r.get()); 208 resourceResponse.setSource(ResourceResponse::Source::Network); 209 ResourceHandle::getConnectionTimingData(connection.get(), resourceResponse.deprecatedNetworkLoadMetrics()); 196 ResourceResponse resourceResponse(r); 197 ResourceHandle::getConnectionTimingData(connection, resourceResponse.deprecatedNetworkLoadMetrics()); 210 198 211 199 m_handle->didReceiveResponse(WTFMove(resourceResponse)); 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 200 }); 201 219 202 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); 220 203 } … … 228 211 LOG(Network, "Handle %p delegate connection:%p didReceiveData:%p lengthReceived:%lld", m_handle, connection, data, lengthReceived); 229 212 230 auto work = [self = self, protectedSelf = RetainPtr<id>(self), data = RetainPtr<NSData>(data)] () mutable{213 dispatch_async(dispatch_get_main_queue(), ^{ 231 214 if (!m_handle || !m_handle->client()) 232 215 return; … … 238 221 // -1 means we do not provide any data about transfer size to inspector so it would use 239 222 // Content-Length headers or content size to show transfer size. 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); 223 m_handle->client()->didReceiveBuffer(m_handle, SharedBuffer::create(data), -1); 224 }); 247 225 } 248 226 … … 255 233 LOG(Network, "Handle %p delegate connection:%p didSendBodyData:%d totalBytesWritten:%d totalBytesExpectedToWrite:%d", m_handle, connection, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); 256 234 257 auto work = [self = self, protectedSelf = RetainPtr<id>(self), totalBytesWritten = totalBytesWritten, totalBytesExpectedToWrite = totalBytesExpectedToWrite] () mutable{235 dispatch_async(dispatch_get_main_queue(), ^{ 258 236 if (!m_handle || !m_handle->client()) 259 237 return; 260 238 m_handle->client()->didSendData(m_handle, totalBytesWritten, totalBytesExpectedToWrite); 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); 239 }); 267 240 } 268 241 … … 274 247 LOG(Network, "Handle %p delegate connectionDidFinishLoading:%p", m_handle, connection); 275 248 276 auto task = [self = self, protectedSelf = RetainPtr<id>(self)] () mutable{249 dispatch_async(dispatch_get_main_queue(), ^{ 277 250 if (!m_handle || !m_handle->client()) 278 251 return; 279 252 280 253 m_handle->client()->didFinishLoading(m_handle); 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); 254 }); 291 255 } 292 256 … … 298 262 LOG(Network, "Handle %p delegate connection:%p didFailWithError:%@", m_handle, connection, error); 299 263 300 auto work = [self = self, protectedSelf = RetainPtr<id>(self), error = RetainPtr<NSError>(error)] () mutable{264 dispatch_async(dispatch_get_main_queue(), ^{ 301 265 if (!m_handle || !m_handle->client()) 302 266 return; 303 267 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); 268 m_handle->client()->didFail(m_handle, error); 269 }); 315 270 } 316 271 … … 323 278 LOG(Network, "Handle %p delegate connection:%p willCacheResponse:%p", m_handle, connection, cachedResponse); 324 279 325 auto work = [self = self, protectedSelf = RetainPtr<id>(self), cachedResponse = RetainPtr<NSCachedURLResponse>(cachedResponse)] () mutable { 280 RetainPtr<id> protector(self); 281 282 dispatch_async(dispatch_get_main_queue(), ^{ 326 283 if (!m_handle || !m_handle->client()) { 327 284 m_cachedResponseResult = nullptr; … … 330 287 } 331 288 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); 289 m_handle->client()->willCacheResponseAsync(m_handle, cachedResponse); 290 }); 339 291 340 292 dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER); -
trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r223271 r223408 356 356 357 357 ResourceResponse responseCopy = d->m_response; 358 d->client()->willSendRequestAsync(handle, WTFMove(newRequest), WTFMove(responseCopy)); 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 359 365 } 360 366 … … 1029 1035 void ResourceHandle::continueWillSendRequest(ResourceRequest&& request) 1030 1036 { 1037 ASSERT(!client() || client()->usesAsyncCallbacks()); 1031 1038 continueAfterWillSendRequest(this, WTFMove(request)); 1032 1039 } … … 1034 1041 void ResourceHandle::continueDidReceiveResponse() 1035 1042 { 1043 ASSERT(!client() || client()->usesAsyncCallbacks()); 1036 1044 continueAfterDidReceiveResponse(this); 1037 1045 } -
trunk/Source/WebKit/ChangeLog
r223299 r223408 1 2017-10-16 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r223271. 4 5 This change introduced LayoutTest failures on WK1. 6 7 Reverted changeset: 8 9 "Use asynchronous ResourceHandleClient calls for WebKit1" 10 https://bugs.webkit.org/show_bug.cgi?id=160677 11 https://trac.webkit.org/changeset/223271 12 1 13 2017-10-13 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.cpp
r223271 r223408 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 #endif85 86 74 void BlobDownloadClient::didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&& buffer, int) 87 75 { -
trunk/Source/WebKit/NetworkProcess/Downloads/BlobDownloadClient.h
r223271 r223408 50 50 void didFinishLoading(WebCore::ResourceHandle*) final; 51 51 void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) final; 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 52 bool usesAsyncCallbacks() final { return true; } 56 53 57 54 Download& m_download; -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r223271 r223408 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, loadParameters.shouldFollowRedirects, WTFMove(completionHandler));254 new PingHandle(context.ptr(), loadParameters.request, loadParameters.storedCredentialsPolicy == StoredCredentialsPolicy::Use, PingHandle::UsesAsyncCallbacks::Yes, loadParameters.shouldFollowRedirects, WTFMove(completionHandler)); 255 255 #endif 256 256 } -
trunk/Source/WebKit/NetworkProcess/NetworkLoad.h
r223271 r223408 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; } 128 129 bool loadingSynchronousXHR() final { return m_client.get().isSynchronous(); } 129 130 #else -
trunk/Source/WebKit/Shared/mac/ArgumentCodersMac.h
r223271 r223408 24 24 */ 25 25 26 #pragma once 26 #ifndef ArgumentCodersMac_h 27 #define ArgumentCodersMac_h 27 28 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
r223271 r223408 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 176 190 #if USE(CFURLCONNECTION) 177 191 void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const ResourceRequest& resourceRequest) … … 204 218 encoder.encodeEnum(resourceRequest.cachePolicy()); 205 219 } 206 207 220 #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 223 221 void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const ResourceRequest& resourceRequest) 224 222 { -
trunk/Source/WebKitLegacy/ChangeLog
r223271 r223408 1 2017-10-16 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r223271. 4 5 This change introduced LayoutTest failures on WK1. 6 7 Reverted changeset: 8 9 "Use asynchronous ResourceHandleClient calls for WebKit1" 10 https://bugs.webkit.org/show_bug.cgi?id=160677 11 https://trac.webkit.org/changeset/223271 12 1 13 2017-10-12 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp
r223271 r223408 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, options.redirect == FetchOptions::Redirect::Follow, WTFMove(completionHandler));366 new PingHandle(frame.loader().networkingContext(), request, options.credentials != FetchOptions::Credentials::Omit, PingHandle::UsesAsyncCallbacks::No, options.redirect == FetchOptions::Redirect::Follow, WTFMove(completionHandler)); 367 367 } 368 368
Note: See TracChangeset
for help on using the changeset viewer.