URLSchemeHandler.Basic API test fails with async policy delegates
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2018 16:11:54 +0000 (16:11 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2018 16:11:54 +0000 (16:11 +0000)
commit695a787d382d6a7439c157dee9eab593bad8b640
tree193f83d9bef4666f3b51833aa9ea0a36ffc097eb
parent29c1882a954298f898c7e26e2674892654ed8728
URLSchemeHandler.Basic API test fails with async policy delegates
https://bugs.webkit.org/show_bug.cgi?id=183678

Reviewed by Alex Christensen.

Source/WebKit:

The issue is that the client calls _didPerformRedirection / didReceiveResponse / didReceiveData / didFinish
on the URLScheme task one after the one, synchronously. However, redirects and responses can be processed
asynchronously. To address the issue, we now queue operations requested by the client if we're waiting
for an async policy delegate.

* WebProcess/WebPage/WebURLSchemeTaskProxy.cpp:
(WebKit::WebURLSchemeTaskProxy::didPerformRedirection):
(WebKit::WebURLSchemeTaskProxy::didReceiveResponse):
(WebKit::WebURLSchemeTaskProxy::didReceiveData):
(WebKit::WebURLSchemeTaskProxy::didComplete):
(WebKit::WebURLSchemeTaskProxy::processNextPendingTask):
* WebProcess/WebPage/WebURLSchemeTaskProxy.h:
(WebKit::WebURLSchemeTaskProxy::queueTask):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:
(-[URLSchemeHandlerAsyncNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
(-[URLSchemeHandlerAsyncNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229666 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebURLSchemeTaskProxy.cpp
Source/WebKit/WebProcess/WebPage/WebURLSchemeTaskProxy.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm