Changeset 247693 in webkit
- Timestamp:
- Jul 22, 2019 11:51:31 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r247689 r247693 1 2019-07-22 Youenn Fablet <youenn@apple.com> 2 3 Make sure to unref captured lambda variables given to _strictTrustEvaluate in the main thread 4 https://bugs.webkit.org/show_bug.cgi?id=199948 5 6 Reviewed by Alex Christensen. 7 8 Use a weak pointer instead of a Ref for the NetworkSession. 9 Add a null check in processServerTrustEvaluation for extra safety if we decide to remove the data task NetworkSession ref. 10 Make sure to move the NetworkDataTask ref in the completion handler so that the unrefing is done in the main thread. 11 12 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 13 (processServerTrustEvaluation): 14 (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): 15 1 16 2019-07-22 Alex Christensen <achristensen@webkit.org> 2 17 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r247567 r247693 551 551 } 552 552 553 static inline void processServerTrustEvaluation(NetworkSessionCocoa *session, NSURLAuthenticationChallenge *challenge, OSStatus trustResult, NetworkDataTaskCocoa::TaskIdentifier taskIdentifier, NetworkDataTaskCocoa* networkDataTask, CompletionHandler<void(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential)>&& completionHandler) 554 { 555 if (trustResult == noErr) { 556 completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); 557 return; 558 } 559 553 static inline void processServerTrustEvaluation(NetworkSessionCocoa *session, NSURLAuthenticationChallenge *challenge, NetworkDataTaskCocoa::TaskIdentifier taskIdentifier, NetworkDataTaskCocoa* networkDataTask, CompletionHandler<void(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential)>&& completionHandler) 554 { 560 555 session->continueDidReceiveChallenge(challenge, taskIdentifier, networkDataTask, [completionHandler = WTFMove(completionHandler), secTrust = retainPtr(challenge.protectionSpace.serverTrust)] (WebKit::AuthenticationChallengeDisposition disposition, const WebCore::Credential& credential) mutable { 561 556 // FIXME: UIProcess should send us back non nil credentials but the credential IPC encoder currently only serializes ns credentials for username/password. … … 595 590 if (canNSURLSessionTrustEvaluate()) { 596 591 auto* networkDataTask = [self existingTask:task]; 597 auto decisionHandler = makeBlockPtr([_session = _session.copyRef(), completionHandler = makeBlockPtr(completionHandler), taskIdentifier, networkDataTask = RefPtr<NetworkDataTaskCocoa>(networkDataTask)](NSURLAuthenticationChallenge *challenge, OSStatus trustResult) mutable { 598 processServerTrustEvaluation(_session.get(), challenge, trustResult, taskIdentifier, networkDataTask.get(), WTFMove(completionHandler)); 592 auto decisionHandler = makeBlockPtr([_session = makeWeakPtr(_session.get()), completionHandler = makeBlockPtr(completionHandler), taskIdentifier, networkDataTask = RefPtr<NetworkDataTaskCocoa>(networkDataTask)](NSURLAuthenticationChallenge *challenge, OSStatus trustResult) mutable { 593 auto task = WTFMove(networkDataTask); 594 auto* session = _session.get(); 595 if (trustResult == noErr || !session) { 596 completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); 597 return; 598 } 599 processServerTrustEvaluation(session, challenge, taskIdentifier, task.get(), WTFMove(completionHandler)); 599 600 }); 600 601 [NSURLSession _strictTrustEvaluate:challenge queue:[NSOperationQueue mainQueue].underlyingQueue completionHandler:decisionHandler.get()];
Note: See TracChangeset
for help on using the changeset viewer.