Commit 2d1368a2 authored by Peter K. Lee's avatar Peter K. Lee Committed by Commit Bot

Calls decisionHandler asynchronously, part 2

Only one of two calls to decisionHandler was converted to async in
http://crrev/c/773570. This changes the other call.

Bug: 774736
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ie72c6efc42e5921eae8983d01f4be29fd3934d98
Reviewed-on: https://chromium-review.googlesource.com/777400Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Peter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517730}
parent e3b1d1e5
......@@ -4220,8 +4220,19 @@ registerLoadRequestForURL:(const GURL&)requestURL
}
}
decisionHandler(allowLoad ? WKNavigationActionPolicyAllow
: WKNavigationActionPolicyCancel);
// Although the Apple documentation says that |handler| can be called
// immediately or saved and called asynchronously, there is a bug in
// iOS 10 (and possibly before) that JavaScript code is not executed
// when the |handler| is called asynchronously.
if (@available(iOS 11, *)) {
dispatch_async(dispatch_get_main_queue(), ^{
decisionHandler(allowLoad ? WKNavigationActionPolicyAllow
: WKNavigationActionPolicyCancel);
});
} else {
decisionHandler(allowLoad ? WKNavigationActionPolicyAllow
: WKNavigationActionPolicyCancel);
}
}
- (void)webView:(WKWebView*)webView
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment