Skip to content

Commit

Permalink
Move heavy operation to background queue
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Jul 12, 2022
1 parent c55a314 commit cdea24e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Blink/TermView.m
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,16 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler {
NSURLCredential *cred = [[NSURLCredential alloc] initWithTrust:challenge.protectionSpace.serverTrust];

if ([challenge.protectionSpace.host isEqual: @"localhost"]) {
// Let localhost go through.
completionHandler(NSURLSessionAuthChallengeUseCredential, cred);
return;
}
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
if ([challenge.protectionSpace.host isEqual: @"localhost"]) {
// Let localhost go through.
completionHandler(NSURLSessionAuthChallengeUseCredential, cred);
return;
}

completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, cred);
});

completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, cred);
}


Expand Down

0 comments on commit cdea24e

Please sign in to comment.