Skip to content

return after decisionHandler called to avoid call it more than once #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2017

Conversation

wrlqwe
Copy link
Contributor

@wrlqwe wrlqwe commented Jul 24, 2017

in the latest version in [WKWebViewJavascriptBridge webView:decidePolicyForNavigationAction:decisionHandler:], after decisionHander executed:

    if ([_base isWebViewJavascriptBridgeURL:url]) {
        if ([_base isBridgeLoadedURL:url]) {
            [_base injectJavascriptFile];
        } else if ([_base isQueueMessageURL:url]) {
            [self WKFlushMessageQueue];
        } else {
            [_base logUnkownMessage:url];
        }
        decisionHandler(WKNavigationActionPolicyCancel);
    }

decisionHandler passed to _webViewDelegate and the delegate method may call decisionHandler again, most conditions it work well, but it leads crash on my iOS11+XCode9 beta environment.
In my view, a decision cannot be made for twice, the decisionHandler that consumed should not pass out side of this method, I hope this commit can fix it.

@wrlqwe
Copy link
Contributor Author

wrlqwe commented Jul 24, 2017

please review my code, I'm not sure this commit meets the requirements for repo users or is it good enough...

@marcuswestin
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants