@@ -5397,6 +5397,92 @@ index 82e6ffd18a3bcd8a14e4a1890fb549269c8b4252..17254c036846b7f80df6bc22e2e01fbc
5397
5397
const String& host = challenge.protectionSpace().host();
5398
5398
NSArray *certificates = [NSURLRequest allowsSpecificHTTPSCertificateForHost:host];
5399
5399
if (!certificates)
5400
+ diff --git a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp
5401
+ index 977a403be8dc962a9ccfa6428bc1d3e7c4682f86..5fb2c30136bffda04d4d5ffacea4511ef86ca427 100644
5402
+ --- a/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp
5403
+ +++ b/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp
5404
+ @@ -26,9 +26,13 @@
5405
+ #include "config.h"
5406
+ #include "NetworkDataTaskCurl.h"
5407
+
5408
+ +#include "APIError.h"
5409
+ #include "AuthenticationChallengeDisposition.h"
5410
+ #include "AuthenticationManager.h"
5411
+ +#include "DataReference.h"
5412
+ +#include "Download.h"
5413
+ #include "NetworkSessionCurl.h"
5414
+ +#include "NetworkProcess.h"
5415
+ #include <WebCore/AuthenticationChallenge.h>
5416
+ #include <WebCore/CookieJar.h>
5417
+ #include <WebCore/CurlRequest.h>
5418
+ @@ -38,6 +42,7 @@
5419
+ #include <WebCore/ResourceError.h>
5420
+ #include <WebCore/SameSiteInfo.h>
5421
+ #include <WebCore/SynchronousLoaderClient.h>
5422
+ +#include <wtf/FileSystem.h>
5423
+
5424
+ namespace WebKit {
5425
+
5426
+ @@ -177,7 +182,12 @@ void NetworkDataTaskCurl::curlDidReceiveBuffer(CurlRequest&, Ref<SharedBuffer>&&
5427
+ auto protectedThis = makeRef(*this);
5428
+ if (state() == State::Canceling || state() == State::Completed || (!m_client && !isDownload()))
5429
+ return;
5430
+ -
5431
+ + if (isDownload()) {
5432
+ + FileSystem::PlatformFileHandle file = FileSystem::openFile(m_pendingDownloadLocation, FileSystem::FileOpenMode::Write);
5433
+ + FileSystem::writeToFile(file, buffer->data(), buffer->size());
5434
+ + FileSystem::closeFile(file);
5435
+ + return;
5436
+ + }
5437
+ m_client->didReceiveData(WTFMove(buffer));
5438
+ }
5439
+
5440
+ @@ -186,6 +196,12 @@ void NetworkDataTaskCurl::curlDidComplete(CurlRequest&, NetworkLoadMetrics&& net
5441
+ if (state() == State::Canceling || state() == State::Completed || (!m_client && !isDownload()))
5442
+ return;
5443
+
5444
+ + if (isDownload()) {
5445
+ + auto* download = m_session->networkProcess().downloadManager().download(m_pendingDownloadID);
5446
+ + ASSERT(download);
5447
+ + download->didFinish();
5448
+ + return;
5449
+ + }
5450
+ m_client->didCompleteWithError({ }, WTFMove(networkLoadMetrics));
5451
+ }
5452
+
5453
+ @@ -199,6 +215,13 @@ void NetworkDataTaskCurl::curlDidFailWithError(CurlRequest& request, ResourceErr
5454
+ return;
5455
+ }
5456
+
5457
+ + if (isDownload()) {
5458
+ + auto* download = m_session->networkProcess().downloadManager().download(m_pendingDownloadID);
5459
+ + ASSERT(download);
5460
+ + download->didFail(resourceError, IPC::DataReference());
5461
+ + return;
5462
+ + }
5463
+ +
5464
+ m_client->didCompleteWithError(resourceError);
5465
+ }
5466
+
5467
+ @@ -235,6 +258,18 @@ void NetworkDataTaskCurl::invokeDidReceiveResponse()
5468
+ break;
5469
+ case PolicyAction::Ignore:
5470
+ break;
5471
+ + case PolicyAction::Download: {
5472
+ + FileSystem::deleteFile(m_pendingDownloadLocation);
5473
+ + auto& downloadManager = m_session->networkProcess().downloadManager();
5474
+ + auto download = makeUnique<Download>(downloadManager, m_pendingDownloadID, *this, *m_session, suggestedFilename());
5475
+ + auto* downloadPtr = download.get();
5476
+ + downloadManager.dataTaskBecameDownloadTask(m_pendingDownloadID, WTFMove(download));
5477
+ + downloadPtr->didCreateDestination(m_pendingDownloadLocation);
5478
+ +
5479
+ + if (m_curlRequest)
5480
+ + m_curlRequest->completeDidReceiveResponse();
5481
+ + break;
5482
+ + }
5483
+ default:
5484
+ notImplemented();
5485
+ break;
5400
5486
diff --git a/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp b/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp
5401
5487
index 20b659f5cf4895e75a2762a9260611cd5f2fff80..ef094ae0d772f9884fd3021ba0eb4f491264ddbf 100644
5402
5488
--- a/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp
@@ -13381,10 +13467,18 @@ index d79c6fdc4fa05e1e4b9acdcc6932e571163320eb..99718b19797788634f4233a8892729b5
13381
13467
int m_toolbarItemsWidth { };
13382
13468
};
13383
13469
diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
13384
- index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..ed9046f38f0b517644f8c5208c8b7800fd2fc9fe 100644
13470
+ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..30eaa65b5600fce08e6153bbd47fdbca900bbd7b 100644
13385
13471
--- a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
13386
13472
+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
13387
- @@ -106,7 +106,7 @@ WKRetainPtr<WKURLRef> createWKURL(const std::wstring& str)
13473
+ @@ -32,6 +32,7 @@
13474
+ #include <WebKit/WKAuthenticationDecisionListener.h>
13475
+ #include <WebKit/WKCertificateInfoCurl.h>
13476
+ #include <WebKit/WKCredential.h>
13477
+ +#include <WebKit/WKFramePolicyListener.h>
13478
+ #include <WebKit/WKInspector.h>
13479
+ #include <WebKit/WKProtectionSpace.h>
13480
+ #include <WebKit/WKProtectionSpaceCurl.h>
13481
+ @@ -106,7 +107,7 @@ WKRetainPtr<WKURLRef> createWKURL(const std::wstring& str)
13388
13482
return adoptWK(WKURLCreateWithUTF8CString(utf8.data()));
13389
13483
}
13390
13484
@@ -13393,7 +13487,7 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..ed9046f38f0b517644f8c5208c8b7800
13393
13487
{
13394
13488
auto conf = adoptWK(WKPageConfigurationCreate());
13395
13489
13396
- @@ -120,8 +120 ,8 @@ Ref<BrowserWindow> WebKitBrowserWindow::create(BrowserWindowClient& client, HWND
13490
+ @@ -120,8 +121 ,8 @@ Ref<BrowserWindow> WebKitBrowserWindow::create(BrowserWindowClient& client, HWND
13397
13491
WKPreferencesSetDeveloperExtrasEnabled(prefs.get(), true);
13398
13492
WKPageConfigurationSetPreferences(conf.get(), prefs.get());
13399
13493
@@ -13404,7 +13498,7 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..ed9046f38f0b517644f8c5208c8b7800
13404
13498
13405
13499
return adoptRef(*new WebKitBrowserWindow(client, conf.get(), mainWnd));
13406
13500
}
13407
- @@ -142,11 +142 ,17 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, WKPageConf
13501
+ @@ -142,11 +143 ,17 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, WKPageConf
13408
13502
navigationClient.didReceiveAuthenticationChallenge = didReceiveAuthenticationChallenge;
13409
13503
WKPageSetPageNavigationClient(page, &navigationClient.base);
13410
13504
@@ -13424,15 +13518,20 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..ed9046f38f0b517644f8c5208c8b7800
13424
13518
WKPageSetPageUIClient(page, &uiClient.base);
13425
13519
13426
13520
WKPageStateClientV0 stateClient = { };
13427
- @@ -158,7 +164,6 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, WKPageConf
13521
+ @@ -158,7 +165,11 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, WKPageConf
13428
13522
stateClient.didChangeActiveURL = didChangeActiveURL;
13429
13523
WKPageSetPageStateClient(page, &stateClient.base);
13430
13524
13431
13525
- updateProxySettings();
13526
+ + WKPagePolicyClientV1 policyClient = { };
13527
+ + policyClient.base.version = 1;
13528
+ + policyClient.base.clientInfo = this;
13529
+ + policyClient.decidePolicyForResponse_deprecatedForUseWithV0 = decidePolicyForResponse;
13530
+ + WKPageSetPagePolicyClient(page, &policyClient.base);
13432
13531
resetZoom();
13433
13532
}
13434
13533
13435
- @@ -182,6 +187 ,29 @@ void WebKitBrowserWindow::updateProxySettings()
13534
+ @@ -182,6 +193 ,29 @@ void WebKitBrowserWindow::updateProxySettings()
13436
13535
WKWebsiteDataStoreEnableCustomNetworkProxySettings(store, url.get(), excludeHosts.get());
13437
13536
}
13438
13537
@@ -13462,23 +13561,21 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..ed9046f38f0b517644f8c5208c8b7800
13462
13561
HRESULT WebKitBrowserWindow::init()
13463
13562
{
13464
13563
return S_OK;
13465
- @@ -250,7 +278 ,6 @@ void WebKitBrowserWindow::openProxySettings()
13564
+ @@ -250,7 +284 ,6 @@ void WebKitBrowserWindow::openProxySettings()
13466
13565
{
13467
13566
if (askProxySettings(m_hMainWnd, m_proxy))
13468
13567
updateProxySettings();
13469
13568
-
13470
13569
}
13471
13570
13472
13571
void WebKitBrowserWindow::setUserAgent(_bstr_t& customUAString)
13473
- @@ -388,18 +415 ,94 @@ bool WebKitBrowserWindow::canTrustServerCertificate(WKProtectionSpaceRef protect
13572
+ @@ -388,18 +421 ,94 @@ bool WebKitBrowserWindow::canTrustServerCertificate(WKProtectionSpaceRef protect
13474
13573
return false;
13475
13574
}
13476
13575
13477
13576
-WKPageRef WebKitBrowserWindow::createNewPage(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
13478
13577
+void WebKitBrowserWindow::closeWindow(WKPageRef page, const void* clientInfo)
13479
- {
13480
- - auto& newWindow = MainWindow::create().leakRef();
13481
- - auto factory = [configuration](BrowserWindowClient& client, HWND mainWnd, bool) -> auto {
13578
+ +{
13482
13579
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
13483
13580
+ PostMessage(thisWindow.m_hMainWnd, WM_CLOSE, 0, 0);
13484
13581
+}
@@ -13505,7 +13602,9 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..ed9046f38f0b517644f8c5208c8b7800
13505
13602
+}
13506
13603
+
13507
13604
+void WebKitBrowserWindow::runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo)
13508
- +{
13605
+ {
13606
+ - auto& newWindow = MainWindow::create().leakRef();
13607
+ - auto factory = [configuration](BrowserWindowClient& client, HWND mainWnd, bool) -> auto {
13509
13608
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
13510
13609
+ WKRetain(listener);
13511
13610
+ thisWindow.m_beforeUnloadDialog = listener;
@@ -13572,8 +13671,20 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..ed9046f38f0b517644f8c5208c8b7800
13572
13671
return newPage.leakRef();
13573
13672
}
13574
13673
13674
+ @@ -408,3 +517,11 @@ void WebKitBrowserWindow::didNotHandleKeyEvent(WKPageRef, WKNativeEventPtr event
13675
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
13676
+ PostMessage(thisWindow.m_hMainWnd, event->message, event->wParam, event->lParam);
13677
+ }
13678
+ +
13679
+ +void WebKitBrowserWindow::decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
13680
+ +{
13681
+ + if (WKURLResponseIsAttachment(response))
13682
+ + WKFramePolicyListenerDownload(listener);
13683
+ + else
13684
+ + WKFramePolicyListenerUse(listener);
13685
+ +}
13575
13686
diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.h b/Tools/MiniBrowser/win/WebKitBrowserWindow.h
13576
- index 373d0de77e852c673a6615e0acedd5195e3c021b..cfeb4f806f79d1a213fdb13346e2b383b9a64273 100644
13687
+ index 373d0de77e852c673a6615e0acedd5195e3c021b..2f25d60c366efa428197dba4a7e0aea6de86af6c 100644
13577
13688
--- a/Tools/MiniBrowser/win/WebKitBrowserWindow.h
13578
13689
+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.h
13579
13690
@@ -26,6 +26,7 @@
@@ -13599,7 +13710,7 @@ index 373d0de77e852c673a6615e0acedd5195e3c021b..cfeb4f806f79d1a213fdb13346e2b383
13599
13710
13600
13711
HRESULT init() override;
13601
13712
HWND hwnd() override;
13602
- @@ -71,6 +75,12 @@ private:
13713
+ @@ -71,11 +75,22 @@ private:
13603
13714
static void didChangeActiveURL(const void*);
13604
13715
static void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef, const void*);
13605
13716
static WKPageRef createNewPage(WKPageRef, WKPageConfigurationRef, WKNavigationActionRef, WKWindowFeaturesRef, const void *);
@@ -13610,9 +13721,10 @@ index 373d0de77e852c673a6615e0acedd5195e3c021b..cfeb4f806f79d1a213fdb13346e2b383
13610
13721
+ static void runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo);
13611
13722
+ static void handleJavaScriptDialog(WKPageRef page, bool accept, WKStringRef value, const void *clientInfo);
13612
13723
static void didNotHandleKeyEvent(WKPageRef, WKNativeEventPtr, const void*);
13724
+ + static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
13613
13725
13614
13726
BrowserWindowClient& m_client;
13615
- @@ -78,4 +88,8 @@ private:
13727
+ WKRetainPtr<WKViewRef> m_view;
13616
13728
HWND m_hMainWnd { nullptr };
13617
13729
ProxySettings m_proxy { };
13618
13730
std::unordered_map<std::wstring, std::wstring> m_acceptedServerTrustCerts;
0 commit comments