WKURLSchemeHandler doesn't handle sync XHR.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Jun 2018 00:34:48 +0000 (00:34 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Jun 2018 00:34:48 +0000 (00:34 +0000)
commita64ee4d2a1c47b5ecfd413fa726e7a89290abfa1
treeecbb08785240b32d3e2fad860bf164a2a3cb56cd
parent21aa9725fd1a22e4781f259fad9dca25b2a19204
WKURLSchemeHandler doesn't handle sync XHR.
<rdar://problem/40955884> and https://bugs.webkit.org/show_bug.cgi?id=186902

Reviewed by Chris Dumez.

Source/WebCore:

* English.lproj/Localizable.strings:

Source/WebKit:

This patch allows WebProcesses to block on sync loads to a custom scheme,
and teaches WebURLSchemeTasks how to buffer up data and the response if
operating synchronously.

* Shared/WebErrors.cpp:
(WebKit::failedCustomProtocolSyncLoad):
* Shared/WebErrors.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::startURLSchemeTask):
(WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::WebURLSchemeHandler::startTask):
* UIProcess/WebURLSchemeHandler.h:

* UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::create):
(WebKit::WebURLSchemeTask::WebURLSchemeTask):
(WebKit::WebURLSchemeTask::didPerformRedirection):
(WebKit::WebURLSchemeTask::didReceiveResponse):
(WebKit::WebURLSchemeTask::didReceiveData):
(WebKit::WebURLSchemeTask::didComplete):
(WebKit::WebURLSchemeTask::pageDestroyed):
(WebKit::WebURLSchemeTask::stop):
* UIProcess/WebURLSchemeTask.h:
(WebKit::WebURLSchemeTask::isSync const):

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::tryLoadingSynchronouslyUsingURLSchemeHandler):
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
* WebProcess/Network/WebLoaderStrategy.h:

* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp:
(WebKit::WebURLSchemeHandlerProxy::loadSynchronously):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:
(-[SyncScheme webView:startURLSchemeTask:]):
(-[SyncScheme webView:stopURLSchemeTask:]):
(-[SyncMessageHandler userContentController:didReceiveScriptMessage:]):
(catch):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233113 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/Shared/WebErrors.cpp
Source/WebKit/Shared/WebErrors.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/WebURLSchemeHandler.cpp
Source/WebKit/UIProcess/WebURLSchemeHandler.h
Source/WebKit/UIProcess/WebURLSchemeTask.cpp
Source/WebKit/UIProcess/WebURLSchemeTask.h
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
Source/WebKit/WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp
Source/WebKit/WebProcess/WebPage/WebURLSchemeHandlerProxy.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm