[GTK][WPE] Move TLS errors API from WebKitContext to WebKitWebsiteDataManager
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Sep 2020 22:14:15 +0000 (22:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Sep 2020 22:14:15 +0000 (22:14 +0000)
commit6eeabe20de6cb577169469ea41159dd96651e6c3
tree10cba7443d81ef2ea511b0b3c63d2e34c069281b
parentb5f06e3604bd3b55e4cc91221b37d5d7140cdcaa
[GTK][WPE] Move TLS errors API from WebKitContext to WebKitWebsiteDataManager
https://bugs.webkit.org/show_bug.cgi?id=216822

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2020-09-23
Reviewed by Alex Christensen.

Source/WebCore:

Make ignoreTLSErrors a member of SoupNetworkSession, instead of being global.

* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::SoupNetworkSession::setIgnoreTLSErrors):
(WebCore::SoupNetworkSession::checkTLSErrors):
(WebCore::SoupNetworkSession::setShouldIgnoreTLSErrors): Deleted.
* platform/network/soup/SoupNetworkSession.h:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setAllowsAnySSLCertificate): Do not use SoupNetworkSession in the web process.

Source/WebKit:

Make TLS errors policy per session instead of global to the network process. The web context API now simply
forwards the request to the website data manager. The website data manager created for an ephemeral web view
will inherit the network settings from the web context website data manager. This ensures backwards
compatibility, but it's also convenient, since it's the desired behavior in most of the cases. Apps can still
change the network settings of the web view by getting the website data manager.

* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate):
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
(WebKit::NetworkProcess::setIgnoreTLSErrors):
* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::NetworkSessionSoup):
(WebKit::webSocketAcceptCertificateCallback):
(WebKit::webSocketMessageNetworkEventCallback):
(WebKit::NetworkSessionSoup::createWebSocketTask):
(WebKit::NetworkSessionSoup::setIgnoreTLSErrors):
* NetworkProcess/soup/NetworkSessionSoup.h:
* UIProcess/API/glib/WebKitAutomationSession.cpp:
(webkitAutomationSessionCreate):
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkit_web_context_set_tls_errors_policy):
(webkit_web_context_get_tls_errors_policy):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConstructed):
(webkit_web_view_class_init):
(webkitWebViewLoadFailedWithTLSErrors):
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkitWebsiteDataManagerConstructed):
(webkitWebsiteDataManagerGetDataStore):
(webkit_website_data_manager_set_tls_errors_policy):
(webkit_website_data_manager_get_tls_errors_policy):
* UIProcess/API/gtk/WebKitWebContext.h:
* UIProcess/API/gtk/WebKitWebsiteDataManager.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitWebContext.h:
* UIProcess/API/wpe/WebKitWebsiteDataManager.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::ignoreTLSErrors const):
* UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp:
(WebKit::WebsiteDataStore::setIgnoreTLSErrors):
* UIProcess/soup/WebProcessPoolSoup.cpp:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
(WebKit::WebProcessPool::setIgnoreTLSErrors): Deleted.

Tools:

Update tests to use the new API instead of the deprecated one. Also update the TLSErrorsPolicy test to also
check that ephemeral web views inherit the network settings from its web context.

* TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp:
(testSSL):
(testInsecureContent):
(testTLSErrorsPolicy):
(testTLSErrorsRedirect):
(testTLSErrorsHTTPAuth):
(testLoadFailedWithTLSErrors):
(testSubresourceLoadFailedWithTLSErrors):
(testWebSocketTLSErrors):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
Source/WebCore/platform/network/soup/SoupNetworkSession.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.h
Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp
Source/WebKit/UIProcess/API/gtk/WebKitWebContext.h
Source/WebKit/UIProcess/API/gtk/WebKitWebsiteDataManager.h
Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt
Source/WebKit/UIProcess/API/wpe/WebKitWebContext.h
Source/WebKit/UIProcess/API/wpe/WebKitWebsiteDataManager.h
Source/WebKit/UIProcess/API/wpe/docs/wpe-1.0-sections.txt
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp
Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp