Commit dd94f654 authored by Peter Lee's avatar Peter Lee Committed by Commit Bot

Revert "Calls decisionsHandler asynchronously"

This reverts commit 445feb54.

Reason for revert: This will break on iOS 11.2 beta.

Original change's description:
> Calls decisionsHandler asynchronously
>
> This change is a precursor to a more extensive change where
> ExternalAppLauncher API is changed to be asynchronous.
>
> This simpler change is to call the decision handler in the implemention
> of WKNavigateDelegate method
> webView:decidePolicyForNavigationResponse:decisionHandler:
> asynchronously on iOS 11 and up.
>
> iOS 10 (and possible below) has a bug where JavaScript on the page would
> not execute if the decision handler is called asynchronously.
>
> This change is to make sure that there are no other unforeseen
> issues with calling decision handler asynchronously on iOS 11.
>
> Bug: 774736
> Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
> Change-Id: I7a6dfe637cb6be4ce5c7efe5824728b8f06b902a
> Reviewed-on: https://chromium-review.googlesource.com/773570
> Commit-Queue: Peter Lee <pkl@chromium.org>
> Reviewed-by: Eugene But <eugenebut@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#517129}

TBR=eugenebut@chromium.org,pkl@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 774736
Change-Id: I007149ee9ef15d4187a76d66f90bc52d21ff09aa
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/782682
Commit-Queue: Peter Lee <pkl@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518342}
parent 1ee9802e
......@@ -4287,19 +4287,8 @@ registerLoadRequestForURL:(const GURL&)requestURL
self.navigationManagerImpl->DiscardNonCommittedItems();
}
// 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(), ^{
handler(allowNavigation ? WKNavigationResponsePolicyAllow
: WKNavigationResponsePolicyCancel);
});
} else {
handler(allowNavigation ? WKNavigationResponsePolicyAllow
: WKNavigationResponsePolicyCancel);
}
handler(allowNavigation ? WKNavigationResponsePolicyAllow
: WKNavigationResponsePolicyCancel);
}
- (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