Changeset 250422 in webkit
- Timestamp:
- Sep 27, 2019, 7:34:13 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r250414 r250422 1 2019-09-27 Alex Christensen <achristensen@webkit.org> 2 3 Remove unused WebProcessPool::setCanHandleHTTPSServerTrustEvaluation 4 https://bugs.webkit.org/show_bug.cgi?id=202285 5 6 Reviewed by Youenn Fablet. 7 8 * http/tests/ssl/certificate-validation-expected.txt: Removed. 9 * http/tests/ssl/certificate-validation.html: Removed. 10 1 11 2019-09-26 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebKit/ChangeLog
r250421 r250422 1 2019-09-27 Alex Christensen <achristensen@webkit.org> 2 3 Remove unused WebProcessPool::setCanHandleHTTPSServerTrustEvaluation 4 https://bugs.webkit.org/show_bug.cgi?id=202285 5 6 Reviewed by Youenn Fablet. 7 8 The SPI to set this was deprecated in r250377 with a replacement that was adopted in rdar://problem/55731135 9 I removed a layout test using the old SPI and replaced it with a more precise API test verifying the behavior of the new SPI 10 before and after the introduction of NSURLSession's _strictTrustEvaluate:queue:completionHandler: 11 12 * NetworkProcess/NetworkProcess.cpp: 13 (WebKit::NetworkProcess::initializeNetworkProcess): 14 (WebKit::NetworkProcess::setCanHandleHTTPSServerTrustEvaluation): Deleted. 15 * NetworkProcess/NetworkProcess.h: 16 (WebKit::NetworkProcess::canHandleHTTPSServerTrustEvaluation const): Deleted. 17 * NetworkProcess/NetworkProcess.messages.in: 18 * NetworkProcess/NetworkProcessCreationParameters.cpp: 19 (WebKit::NetworkProcessCreationParameters::encode const): 20 (WebKit::NetworkProcessCreationParameters::decode): 21 * NetworkProcess/NetworkProcessCreationParameters.h: 22 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 23 (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): 24 (canNSURLSessionTrustEvaluate): Deleted. 25 * UIProcess/API/C/WKContext.cpp: 26 (WKContextSetCanHandleHTTPSServerTrustEvaluation): 27 * UIProcess/API/Cocoa/WKProcessPool.mm: 28 (-[WKProcessPool _setCanHandleHTTPSServerTrustEvaluation:]): 29 * UIProcess/WebProcessPool.cpp: 30 (WebKit::WebProcessPool::ensureNetworkProcess): 31 (WebKit::WebProcessPool::setCanHandleHTTPSServerTrustEvaluation): Deleted. 32 * UIProcess/WebProcessPool.h: 33 1 34 2019-09-27 Alex Christensen <achristensen@webkit.org> 2 35 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r250413 r250422 308 308 setCacheModel(parameters.cacheModel, parameters.defaultDataStoreParameters.networkSessionParameters.networkCacheDirectory); 309 309 310 setCanHandleHTTPSServerTrustEvaluation(parameters.canHandleHTTPSServerTrustEvaluation);311 312 310 if (parameters.shouldUseTestingNetworkSession) { 313 311 m_shouldUseTestingNetworkStorageSession = true; … … 2018 2016 } 2019 2017 2020 void NetworkProcess::setCanHandleHTTPSServerTrustEvaluation(bool value)2021 {2022 m_canHandleHTTPSServerTrustEvaluation = value;2023 }2024 2025 2018 void NetworkProcess::getNetworkProcessStatistics(uint64_t callbackID) 2026 2019 { -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r250413 r250422 178 178 void ensureSession(const PAL::SessionID&, const String& identifier); 179 179 #endif 180 181 bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; }182 180 183 181 void processWillSuspendImminently(); … … 415 413 void setCacheModel(CacheModel, String overrideCacheStorageDirectory); 416 414 void allowSpecificHTTPSCertificateForHost(const WebCore::CertificateInfo&, const String& host); 417 void setCanHandleHTTPSServerTrustEvaluation(bool);418 415 void getNetworkProcessStatistics(uint64_t callbackID); 419 416 void clearCacheForAllOrigins(uint32_t cachesToClear); … … 481 478 bool m_suppressMemoryPressureHandler { false }; 482 479 bool m_diskCacheIsDisabledForTesting { false }; 483 bool m_canHandleHTTPSServerTrustEvaluation { true };484 480 String m_uiProcessBundleIdentifier; 485 481 DownloadManager m_downloadManager; -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in
r250413 r250422 68 68 69 69 AllowSpecificHTTPSCertificateForHost(WebCore::CertificateInfo certificate, String host) 70 SetCanHandleHTTPSServerTrustEvaluation(bool value)71 70 72 71 GetNetworkProcessStatistics(uint64_t callbackID) -
trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
r250421 r250422 41 41 { 42 42 encoder.encodeEnum(cacheModel); 43 encoder << canHandleHTTPSServerTrustEvaluation;44 43 #if PLATFORM(MAC) 45 44 encoder << uiProcessCookieStorageIdentifier; … … 95 94 if (!decoder.decodeEnum(result.cacheModel)) 96 95 return false; 97 if (!decoder.decode(result.canHandleHTTPSServerTrustEvaluation))98 return false;99 96 100 97 #if PLATFORM(MAC) -
trunk/Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
r250421 r250422 53 53 54 54 CacheModel cacheModel { CacheModel::DocumentViewer }; 55 bool canHandleHTTPSServerTrustEvaluation { true };56 55 57 56 #if PLATFORM(MAC) -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r250377 r250422 539 539 540 540 #if HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE) 541 static bool canNSURLSessionTrustEvaluate()542 {543 return [NSURLSession respondsToSelector:@selector(_strictTrustEvaluate: queue: completionHandler:)];544 }545 546 541 static inline void processServerTrustEvaluation(NetworkSessionCocoa *session, NSURLAuthenticationChallenge *challenge, NetworkDataTaskCocoa::TaskIdentifier taskIdentifier, NetworkDataTaskCocoa* networkDataTask, CompletionHandler<void(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential)>&& completionHandler) 547 542 { … … 579 574 580 575 // Handle server trust evaluation at platform-level if requested, for performance reasons and to use ATS defaults. 581 if ( !_session->networkProcess().canHandleHTTPSServerTrustEvaluation() ||_session->fastServerTrustEvaluationEnabled()) {576 if (_session->fastServerTrustEvaluationEnabled()) { 582 577 #if HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE) 583 if (canNSURLSessionTrustEvaluate()) { 584 auto* networkDataTask = [self existingTask:task]; 585 ASSERT(networkDataTask); 586 auto decisionHandler = makeBlockPtr([_session = makeWeakPtr(_session.get()), completionHandler = makeBlockPtr(completionHandler), taskIdentifier, networkDataTask = RefPtr<NetworkDataTaskCocoa>(networkDataTask)](NSURLAuthenticationChallenge *challenge, OSStatus trustResult) mutable { 587 auto task = WTFMove(networkDataTask); 588 auto* session = _session.get(); 589 if (trustResult == noErr || !session) { 590 completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); 591 return; 592 } 593 processServerTrustEvaluation(session, challenge, taskIdentifier, task.get(), WTFMove(completionHandler)); 594 }); 595 [NSURLSession _strictTrustEvaluate:challenge queue:[NSOperationQueue mainQueue].underlyingQueue completionHandler:decisionHandler.get()]; 596 return; 597 } 598 #endif 578 auto* networkDataTask = [self existingTask:task]; 579 ASSERT(networkDataTask); 580 auto decisionHandler = makeBlockPtr([_session = makeWeakPtr(_session.get()), completionHandler = makeBlockPtr(completionHandler), taskIdentifier, networkDataTask = RefPtr<NetworkDataTaskCocoa>(networkDataTask)](NSURLAuthenticationChallenge *challenge, OSStatus trustResult) mutable { 581 auto task = WTFMove(networkDataTask); 582 auto* session = _session.get(); 583 if (trustResult == noErr || !session) { 584 completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); 585 return; 586 } 587 processServerTrustEvaluation(session, challenge, taskIdentifier, task.get(), WTFMove(completionHandler)); 588 }); 589 [NSURLSession _strictTrustEvaluate:challenge queue:[NSOperationQueue mainQueue].underlyingQueue completionHandler:decisionHandler.get()]; 590 return; 591 #else 599 592 return completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); 593 #endif 600 594 } 601 595 } -
trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp
r250421 r250422 382 382 void WKContextSetCanHandleHTTPSServerTrustEvaluation(WKContextRef contextRef, bool value) 383 383 { 384 WebKit::toImpl(contextRef)->setCanHandleHTTPSServerTrustEvaluation(value);385 384 } 386 385 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
r250292 r250422 202 202 - (void)_setCanHandleHTTPSServerTrustEvaluation:(BOOL)value 203 203 { 204 _processPool->setCanHandleHTTPSServerTrustEvaluation(value);205 204 } 206 205 -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r250421 r250422 492 492 493 493 parameters.cacheModel = LegacyGlobalSettings::singleton().cacheModel(); 494 parameters.canHandleHTTPSServerTrustEvaluation = m_canHandleHTTPSServerTrustEvaluation;495 494 496 495 for (auto& scheme : globalURLSchemesWithCustomProtocolHandlers()) … … 1504 1503 m_schemesToSetDomainRelaxationForbiddenFor.add(urlScheme); 1505 1504 sendToAllProcesses(Messages::WebProcess::SetDomainRelaxationForbiddenForURLScheme(urlScheme)); 1506 }1507 1508 void WebProcessPool::setCanHandleHTTPSServerTrustEvaluation(bool value)1509 {1510 m_canHandleHTTPSServerTrustEvaluation = value;1511 if (m_networkProcess) {1512 m_networkProcess->send(Messages::NetworkProcess::SetCanHandleHTTPSServerTrustEvaluation(value), 0);1513 return;1514 }1515 1505 } 1516 1506 -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r250321 r250422 268 268 void registerURLSchemeAsBypassingContentSecurityPolicy(const String&); 269 269 void setDomainRelaxationForbiddenForURLScheme(const String&); 270 void setCanHandleHTTPSServerTrustEvaluation(bool);271 270 void registerURLSchemeAsLocal(const String&); 272 271 void registerURLSchemeAsNoAccess(const String&); … … 709 708 bool m_processTerminationEnabled { true }; 710 709 711 bool m_canHandleHTTPSServerTrustEvaluation { true };712 710 bool m_didNetworkProcessCrash { false }; 713 711 std::unique_ptr<NetworkProcessProxy> m_networkProcess; -
trunk/Tools/ChangeLog
r250421 r250422 1 2019-09-27 Alex Christensen <achristensen@webkit.org> 2 3 Remove unused WebProcessPool::setCanHandleHTTPSServerTrustEvaluation 4 https://bugs.webkit.org/show_bug.cgi?id=202285 5 6 Reviewed by Youenn Fablet. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm: 9 (-[ServerTrustDelegate webView:didFinishNavigation:]): 10 (-[ServerTrustDelegate webView:didFailProvisionalNavigation:withError:]): 11 (-[ServerTrustDelegate waitForDidFinishNavigation]): 12 (-[ServerTrustDelegate waitForDidFailProvisionalNavigationError]): 13 (-[ServerTrustDelegate authenticationChallengeCount]): 14 (-[ServerTrustDelegate webView:didReceiveAuthenticationChallenge:completionHandler:]): 15 (TestWebKitAPI::TEST): 16 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 17 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 18 (WTR::TestRunner::setCanHandleHTTPSServerTrustEvaluation): Deleted. 19 (WTR::TestRunner::canDoServerTrustEvaluationInNetworkProcess): Deleted. 20 (WTR::TestRunner::serverTrustEvaluationCallbackCallsCount): Deleted. 21 * WebKitTestRunner/InjectedBundle/TestRunner.h: 22 * WebKitTestRunner/TestController.cpp: 23 (WTR::TestController::resetStateToConsistentValues): 24 (WTR::TestController::didReceiveAuthenticationChallenge): 25 (WTR::TestController::canDoServerTrustEvaluationInNetworkProcess const): Deleted. 26 * WebKitTestRunner/TestController.h: 27 (WTR::TestController::serverTrustEvaluationCallbackCallsCount const): Deleted. 28 * WebKitTestRunner/TestInvocation.cpp: 29 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 30 * WebKitTestRunner/cocoa/TestControllerCocoa.mm: 31 (WTR::TestController::canDoServerTrustEvaluationInNetworkProcess const): Deleted. 32 1 33 2019-09-27 Alex Christensen <achristensen@webkit.org> 2 34 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm
r248181 r250422 34 34 #import <WebKit/WKProcessPoolPrivate.h> 35 35 #import <WebKit/WKWebsiteDataRecordPrivate.h> 36 #import <WebKit/WKWebsiteDataStorePrivate.h> 36 37 #import <WebKit/WebKit.h> 38 #import <WebKit/_WKErrorRecoveryAttempting.h> 39 #import <WebKit/_WKWebsiteDataStoreConfiguration.h> 40 #import <wtf/Platform.h> 37 41 #import <wtf/RetainPtr.h> 38 42 #import <wtf/spi/cocoa/SecuritySPI.h> … … 285 289 286 290 @interface ServerTrustDelegate : NSObject <WKNavigationDelegate> 287 @end 288 289 @implementation ServerTrustDelegate 290 291 - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation 292 { 293 navigationFinished = true; 291 - (void)waitForDidFinishNavigation; 292 - (NSError *)waitForDidFailProvisionalNavigationError; 293 - (size_t)authenticationChallengeCount; 294 @end 295 296 @implementation ServerTrustDelegate { 297 size_t _authenticationChallengeCount; 298 bool _navigationFinished; 299 RetainPtr<NSError> _provisionalNavigationFailedError; 300 } 301 302 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation 303 { 304 _navigationFinished = true; 305 } 306 307 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error 308 { 309 _provisionalNavigationFailedError = error; 310 } 311 312 - (void)waitForDidFinishNavigation 313 { 314 TestWebKitAPI::Util::run(&_navigationFinished); 315 } 316 317 - (NSError *)waitForDidFailProvisionalNavigationError 318 { 319 while (!_provisionalNavigationFailedError) 320 TestWebKitAPI::Util::spinRunLoop(); 321 return _provisionalNavigationFailedError.autorelease(); 322 } 323 324 - (size_t)authenticationChallengeCount 325 { 326 return _authenticationChallengeCount; 294 327 } 295 328 296 329 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler 297 330 { 331 _authenticationChallengeCount++; 298 332 SecTrustRef trust = challenge.protectionSpace.serverTrust; 299 333 verifyCertificateAndPublicKey(trust); … … 322 356 323 357 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://localhost:%d/", server.port()]]]]; 324 TestWebKitAPI::Util::run(&navigationFinished);358 [delegate waitForDidFinishNavigation]; 325 359 326 360 verifyCertificateAndPublicKey([webView serverTrust]); 361 EXPECT_EQ([delegate authenticationChallengeCount], 1u); 362 } 363 364 TEST(WebKit, FastServerTrust) 365 { 366 #if HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE) 367 TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK); 368 #else 369 TCPServer server(TCPServer::Protocol::HTTPS, [](SSL* ssl) { 370 EXPECT_FALSE(ssl); 371 }); 372 #endif 373 WKWebViewConfiguration *configuration = [[[WKWebViewConfiguration alloc] init] autorelease]; 374 _WKWebsiteDataStoreConfiguration *dataStoreConfiguration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease]; 375 dataStoreConfiguration.fastServerTrustEvaluationEnabled = YES; 376 configuration.websiteDataStore = [[[WKWebsiteDataStore alloc] _initWithConfiguration:dataStoreConfiguration] autorelease]; 377 auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration]); 378 auto delegate = adoptNS([ServerTrustDelegate new]); 379 [webView setNavigationDelegate:delegate.get()]; 380 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://localhost:%d/", server.port()]]]]; 381 #if HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE) 382 [delegate waitForDidFinishNavigation]; 383 EXPECT_EQ([delegate authenticationChallengeCount], 1ull); 384 #else 385 NSError *error = [delegate waitForDidFailProvisionalNavigationError]; 386 EXPECT_WK_STREQ([error.userInfo[_WKRecoveryAttempterErrorKey] className], @"WKReloadFrameErrorRecoveryAttempter"); 387 EXPECT_WK_STREQ(error.domain, NSURLErrorDomain); 388 EXPECT_EQ(error.code, NSURLErrorServerCertificateUntrusted); 389 EXPECT_EQ([delegate authenticationChallengeCount], 0ull); 390 #endif 327 391 } 328 392 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r250413 r250422 367 367 void terminateServiceWorkerProcess(); 368 368 369 void setCanHandleHTTPSServerTrustEvaluation(boolean canHandle);370 readonly attribute boolean canDoServerTrustEvaluationInNetworkProcess;371 369 readonly attribute unsigned long serverTrustEvaluationCallbackCallsCount; 372 370 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r250413 r250422 2930 2930 } 2931 2931 2932 void TestRunner::setCanHandleHTTPSServerTrustEvaluation(bool canHandle)2933 {2934 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetCanHandleHTTPSServerTrustEvaluation"));2935 WKRetainPtr<WKBooleanRef> messageBody = adoptWK(WKBooleanCreate(canHandle));2936 WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);2937 }2938 2939 bool TestRunner::canDoServerTrustEvaluationInNetworkProcess()2940 {2941 WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CanDoServerTrustEvaluationInNetworkProcess"));2942 WKTypeRef returnData = nullptr;2943 WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), nullptr, &returnData);2944 ASSERT(WKGetTypeID(returnData) == WKBooleanGetTypeID());2945 return WKBooleanGetValue(adoptWK(static_cast<WKBooleanRef>(returnData)).get());2946 }2947 2948 2932 unsigned long TestRunner::serverTrustEvaluationCallbackCallsCount() 2949 2933 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r250413 r250422 495 495 bool keyExistsInKeychain(JSStringRef attrLabel, JSStringRef applicationTagBase64); 496 496 497 void setCanHandleHTTPSServerTrustEvaluation(bool canHandle);498 bool canDoServerTrustEvaluationInNetworkProcess();499 497 unsigned long serverTrustEvaluationCallbackCallsCount(); 500 498 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r250421 r250422 3577 3577 } 3578 3578 3579 bool TestController::canDoServerTrustEvaluationInNetworkProcess() const3580 {3581 return false;3582 }3583 3584 3579 void TestController::installCustomMenuAction(const String&, bool) 3585 3580 { -
trunk/Tools/WebKitTestRunner/TestController.h
r250413 r250422 311 311 void installCustomMenuAction(const String& name, bool dismissesAutomatically); 312 312 313 bool canDoServerTrustEvaluationInNetworkProcess() const;314 313 uint64_t serverTrustEvaluationCallbackCallsCount() const { return m_serverTrustEvaluationCallbackCallsCount; } 315 314 -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r250413 r250422 1630 1630 } 1631 1631 1632 if (WKStringIsEqualToUTF8CString(messageName, "SetCanHandleHTTPSServerTrustEvaluation")) {1633 ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());1634 auto canHandle = WKBooleanGetValue(static_cast<WKBooleanRef>(messageBody));1635 WKContextSetCanHandleHTTPSServerTrustEvaluation(TestController::singleton().context(), canHandle);1636 return nullptr;1637 }1638 1639 if (WKStringIsEqualToUTF8CString(messageName, "CanDoServerTrustEvaluationInNetworkProcess")) {1640 WKRetainPtr<WKTypeRef> result = adoptWK(WKBooleanCreate(TestController::singleton().canDoServerTrustEvaluationInNetworkProcess()));1641 return result;1642 }1643 1644 1632 if (WKStringIsEqualToUTF8CString(messageName, "ServerTrustEvaluationCallbackCallsCount")) { 1645 1633 WKRetainPtr<WKTypeRef> result = adoptWK(WKUInt64Create(TestController::singleton().serverTrustEvaluationCallbackCallsCount())); -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r250249 r250422 412 412 } 413 413 414 bool TestController::canDoServerTrustEvaluationInNetworkProcess() const415 {416 #if HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE)417 return true;418 #else419 return false;420 #endif421 }422 423 414 void TestController::installCustomMenuAction(const String& name, bool dismissesAutomatically) 424 415 {
Note:
See TracChangeset
for help on using the changeset viewer.