RESOLVED FIXED 176625
decidePolicyForNavigationAction's decisionHandler is not getting called if it is in Async Block.
https://bugs.webkit.org/show_bug.cgi?id=176625
Summary decidePolicyForNavigationAction's decisionHandler is not getting called if it...
Raghavendra
Reported 2017-09-08 12:46:25 PDT
Created attachment 320290 [details] Sample WkWebView app for simulating issue in decidePolicyForNavigationAction Hi, We are having issue with decidePolicyForNavigationAction callback function. We found that evaluateJavaScript method fails to invoke its completionHandler callback when called within decidePolicyForNavigationAction delegate and before its decisionHandler was called. While this is working in current iOS10 but fails on iOS11 beta. This code flow is as per Apple’s documentation - https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview?language=objc decisionHandler never gets called if it is in Async block in decidePolicyForNavigationAction delegate callback. Below is the code snippet which works in iOS10 & not on iOS11. - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler{ NSLog(@"decidePolicyForNavigatiAction"); [_webView evaluateJavaScript:@"document.getElementById('demo').innerHTML = \"Change Content of Paragraph\"" completionHandler:^(id result, NSError * _Nullable error) { NSLog(@"The Result is:%@",result); decisionHandler(WKNavigationActionPolicyCancel); //Never gets called }]; } Thanks Raghavendra
Attachments
Sample WkWebView app for simulating issue in decidePolicyForNavigationAction (59.91 KB, application/zip)
2017-09-08 12:46 PDT, Raghavendra
no flags
Raghavendra
Comment 1 2017-10-11 09:01:59 PDT
Looks like issue solved in latest iOS 11.1 Beta 2 – 604.3.3
Note You need to log in before you can comment on or make changes to this bug.