Fix custom header field setting with reloads and asynchronous navigation action polic...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Oct 2017 19:21:37 +0000 (19:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Oct 2017 19:21:37 +0000 (19:21 +0000)
commitfd06c1550d5339b2a4bfdbe1bdff65d3777c2268
treeeef1572c50c7825c78257d0ffd0979dc5622268b
parente6f1e0238354a641b4b8c20adbbe78bff5e78d7f
Fix custom header field setting with reloads and asynchronous navigation action policy decisions
https://bugs.webkit.org/show_bug.cgi?id=179064

Patch by Alex Christensen <achristensen@webkit.org> on 2017-10-31
Reviewed by Tim Horton.

Source/WebCore:

r223909 had two problems:
1. It called addHTTPHeaderField instead of setHTTPHeaderField, so when a page is reloaded the header field
is added to the resource request to be reloaded, which already had the headers added.
2. It only worked in the synchronous decidePolicyForNavigationAction code path, not for asynchronous completion handlers.

These are both fixed, and both cases are covered with new API tests.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):

Source/WebKit:

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::applyToDocumentLoader):
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::didReceivePolicyDecision):
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didReceivePolicyDecision):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(-[CustomHeaderFieldsDelegate _webView:decidePolicyForNavigationAction:decisionHandler:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedResourceLoader.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit/WebProcess/WebPage/WebFrame.cpp
Source/WebKit/WebProcess/WebPage/WebFrame.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm