Commit dc7f6fcf authored by David Jean's avatar David Jean Committed by Commit Bot

[ios] Try to avoid crash on null context during navigation

Add a missing null check on context.
Also changed navigation not to check state to determine if commit has
already happened, since the state machine being uncertain, state not
being 'commit' doesn't mean commit has not been called before.

Bug: 1041368
Change-Id: I6f77c2137e30c46b8180f35e584833cd57f8f7db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003134Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: David Jean <djean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733568}
parent 3c1f9e2d
...@@ -757,7 +757,7 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation( ...@@ -757,7 +757,7 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
web::NavigationContextImpl* context = web::NavigationContextImpl* context =
[self.navigationStates contextForNavigation:navigation]; [self.navigationStates contextForNavigation:navigation];
if (!web::IsWKWebViewSSLCertError(context->GetError())) { if (context && !web::IsWKWebViewSSLCertError(context->GetError())) {
_certVerificationErrors->Clear(); _certVerificationErrors->Clear();
} }
...@@ -945,8 +945,7 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation( ...@@ -945,8 +945,7 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
// Sometimes |webView:didFinishNavigation| arrives before // Sometimes |webView:didFinishNavigation| arrives before
// |webView:didCommitNavigation|. Explicitly trigger post-commit processing. // |webView:didCommitNavigation|. Explicitly trigger post-commit processing.
bool navigationCommitted = bool navigationCommitted =
[self.navigationStates stateForNavigation:navigation] == [self.navigationStates isCommittedNavigation:navigation];
web::WKNavigationState::COMMITTED;
UMA_HISTOGRAM_BOOLEAN("IOS.WKWebViewFinishBeforeCommit", UMA_HISTOGRAM_BOOLEAN("IOS.WKWebViewFinishBeforeCommit",
!navigationCommitted); !navigationCommitted);
if (!navigationCommitted) { if (!navigationCommitted) {
......
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