Skip to content

Commit 5614ea6

Browse files
committed
2 parents d8142d2 + 7207111 commit 5614ea6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

WebViewJavascriptBridge/WKWebViewJavascriptBridge.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ - (void)webView:(WKWebView *)webView
120120
} else {
121121
[_base logUnkownMessage:url];
122122
}
123-
[webView stopLoading];
123+
decisionHandler(WKNavigationActionPolicyCancel);
124124
}
125125

126126
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:decidePolicyForNavigationAction:decisionHandler:)]) {
@@ -151,6 +151,17 @@ - (void)webView:(WKWebView *)webView
151151
}
152152
}
153153

154+
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
155+
if (webView != _webView) { return; }
156+
157+
_base.numRequestsLoading--;
158+
159+
__strong typeof(_webViewDelegate) strongDelegate = _webViewDelegate;
160+
if (strongDelegate && [strongDelegate respondsToSelector:@selector(webView:didFailProvisionalNavigation:withError:)]) {
161+
[strongDelegate webView:webView didFailProvisionalNavigation:navigation withError:error];
162+
}
163+
}
164+
154165
- (NSString*) _evaluateJavascript:(NSString*)javascriptCommand
155166
{
156167
[_webView evaluateJavaScript:javascriptCommand completionHandler:nil];

0 commit comments

Comments
 (0)