31
31
#include < wtf/glib/WTFGType.h>
32
32
#include < wtf/text/CString.h>
33
33
34
+ #if ENABLE(2022_GLIB_API)
35
+ #include " WebKitNetworkSession.h"
36
+ #endif
37
+
34
38
using namespace WebKit ;
35
39
36
40
/* *
@@ -350,13 +354,27 @@ WebKitAutomationSession* webkitAutomationSessionCreate(WebKitWebCon
A3D3
text* webCont
350
354
{
351
355
auto * session = WEBKIT_AUTOMATION_SESSION (g_object_new (WEBKIT_TYPE_AUTOMATION_SESSION, " id" , sessionID, nullptr ));
352
356
session->priv ->webContext = webContext;
353
- if (capabilities.acceptInsecureCertificates )
357
+ #if ENABLE(2022_GLIB_API)
358
+ WebKitNetworkSession* networkSession = webkitWebContextGetNetworkSessionForAutomation (webContext);
359
+ #endif
360
+
361
+ if (capabilities.acceptInsecureCertificates ) {
362
+ #if ENABLE(2022_GLIB_API)
363
+ webkit_network_session_set_tls_errors_policy (networkSession, WEBKIT_TLS_ERRORS_POLICY_IGNORE);
364
+ #else
354
365
webkit_website_data_manager_set_tls_errors_policy (webkit_web_context_get_website_data_manager (webContext), WEBKIT_TLS_ERRORS_POLICY_IGNORE);
366
+ #endif
367
+ }
355
368
356
369
for (auto & certificate : capabilities.certificates ) {
357
370
GRefPtr<GTlsCertificate> tlsCertificate = adoptGRef (g_tls_certificate_new_from_file (certificate.second .utf8 ().data (), nullptr ));
358
- if (tlsCertificate)
371
+ if (tlsCertificate) {
372
+ #if ENABLE(2022_GLIB_API)
373
+ webkit_network_session_allow_tls_certificate_for_host (networkSession, tlsCertificate.get (), certificate.first .utf8 ().data ());
374
+ #else
359
375
webkit_web_context_allow_tls_certificate_for_host (webContext, tlsCertificate.get (), certificate.first .utf8 ().data ());
376
+ #endif
377
+ }
360
378
}
361
379
if (capabilities.proxy ) {
362
380
if (capabilities.proxy ->type == " pac" _s) {
@@ -365,13 +383,21 @@ WebKitAutomationSession* webkitAutomationSessionCreate(WebKitWebContext* webCont
365
383
if (capabilities.proxy ->autoconfigURL )
366
384
settings.defaultProxyURL = capabilities.proxy ->autoconfigURL ->utf8 ();
367
385
if (!settings.isEmpty ()) {
386
+ #if ENABLE(2022_GLIB_API)
387
+ auto & dataStore = webkitWebsiteDataManagerGetDataStore (webkit_network_session_get_website_data_manager (networkSession));
388
+ #else
368
389
auto & dataStore = webkitWebsiteDataManagerGetDataStore (webkit_web_context_get_website_data_manager (webContext));
390
+ #endif
369
391
dataStore.setNetworkProxySettings (WTFMove (settings));
370
392
}
371
393
} else {
372
394
WebKitNetworkProxySettings* proxySettings = nullptr ;
373
395
auto proxyMode = parseProxyCapabilities (*capabilities.proxy , &proxySettings);
396
+ #if ENABLE(2022_GLIB_API)
397
+ webkit_network_session_set_proxy_settings (networkSession, proxyMode, proxySettings);
398
+ #else
374
399
webkit_website_data_manager_set_network_proxy_settings (webkit_web_context_get_website_data_manager (webContext), proxyMode, proxySettings);
400
+ #endif
375
401
if (proxySettings)
376
402
webkit_network_proxy_settings_free (proxySettings);
377
403
}
0 commit comments