Add infrastructure for adding custom headers to requests per website
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Sep 2017 01:15:23 +0000 (01:15 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Sep 2017 01:15:23 +0000 (01:15 +0000)
commit62761e8cde38a512ef6cb7f35dc1b4f00164c84d
tree4f39eacbac4746784a6dfc196dc721251de5584a
parent96adc0a21ea5483084eb3928bd3337770e933372
Add infrastructure for adding custom headers to requests per website
https://bugs.webkit.org/show_bug.cgi?id=177255

Reviewed by Geoffrey Garen.

Source/WebCore:

Covered by API tests.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* loader/DocumentLoader.cpp:
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setCustomHeaderFields):
* loader/HTTPHeaderField.cpp: Added.
(WebCore::RFC7230::isTokenCharacter):
(WebCore::RFC7230::isDelimiter):
(WebCore::RFC7230::isVisibleCharacter):
(WebCore::RFC7230::isWhitespace):
(WebCore::RFC7230::isInRange):
(WebCore::RFC7230::isOBSText):
(WebCore::RFC7230::isQuotedTextCharacter):
(WebCore::RFC7230::isQuotedPairSecondOctet):
(WebCore::RFC7230::isCommentText):
(WebCore::RFC7230::isValidName):
(WebCore::RFC7230::isValidValue):
(WebCore::HTTPHeaderField::HTTPHeaderField):
* loader/HTTPHeaderField.h: Added.
(WebCore::HTTPHeaderField::encode const):
(WebCore::HTTPHeaderField::decode):

Source/WebKit:

* Shared/WebsitePolicies.cpp: Added.
* Shared/WebsitePolicies.h:
(WebKit::WebsitePolicies::encode const):
(WebKit::WebsitePolicies::decode):
* UIProcess/API/APIWebsitePolicies.h:
* UIProcess/API/C/WKWebsitePolicies.cpp:
(WKWebsitePoliciesCopyCustomHeaderFields):
(WKWebsitePoliciesSetCustomHeaderFields):
* UIProcess/API/C/WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
(-[_WKWebsitePolicies customHeaderFields]):
(-[_WKWebsitePolicies setCustomHeaderFields:]):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/HTTPHeaderField.cpp: Added.
(shouldRemainUnchanged):
(shouldBeInvalid):
(shouldBecome):
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/loader/HTTPHeaderField.cpp [new file with mode: 0644]
Source/WebCore/loader/HTTPHeaderField.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebsitePolicies.h
Source/WebKit/UIProcess/API/APIWebsitePolicies.h
Source/WebKit/UIProcess/API/C/WKWebsitePolicies.cpp
Source/WebKit/UIProcess/API/C/WKWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebCore/HTTPHeaderField.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm