Commit b1986bc0 authored by Eugene But's avatar Eugene But Committed by Chromium LUCI CQ

Do not ignore null navigation context on iOS 13

Workaround for null context was necessary on iOS 12
as confirmed by Navigation.IOSNullContextInDidFailProvisionalNavigation
histogram. Also stop recording Navigation.IOSNullContextInDidFailProvisionalNavigation
as this histogram has expired and served its purpose.

Bug: None
Change-Id: Id2df18c8e92c134049a820b6a38af403c38bac6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638447
Commit-Queue: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845902}
parent 3c31df08
......@@ -5,6 +5,7 @@
#import "ios/web/navigation/crw_wk_navigation_handler.h"
#include "base/feature_list.h"
#include "base/ios/ios_util.h"
#import "base/ios/ns_error_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
......@@ -1817,11 +1818,8 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
web::RequiresProvisionalNavigationFailureWorkaround()) {
// It is likely that |navigationContext| is null because
// didStartProvisionalNavigation: was not called with this WKNavigation
// object. Log UMA to know when this workaround can be removed and
// do not call OnNavigationFinished() to avoid crash on null pointer
// dereferencing. See crbug.com/973653 and crbug.com/1004634 for details.
UMA_HISTOGRAM_BOOLEAN(
"Navigation.IOSNullContextInDidFailProvisionalNavigation", true);
// object, which was pretty common on iOS 12 and fixed on iOS 13.
// See crbug.com/973653 and crbug.com/1004634 for details.
return;
}
}
......@@ -2059,16 +2057,10 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
}
if (provisionalLoad) {
if (!navigationContext &&
web::RequiresProvisionalNavigationFailureWorkaround()) {
if (base::ios::IsRunningOnIOS13OrLater() || navigationContext) {
// It is likely that |navigationContext| is null because
// didStartProvisionalNavigation: was not called with this WKNavigation
// object. Log UMA to know when this workaround can be removed and
// do not call OnNavigationFinished() to avoid crash on null pointer
// dereferencing. See crbug.com/973653 for details.
UMA_HISTOGRAM_BOOLEAN(
"Navigation.IOSNullContextInDidFailProvisionalNavigation", true);
} else {
// object. See crbug.com/973653 for details.
self.webStateImpl->OnNavigationFinished(navigationContext.get());
}
}
......
......@@ -671,8 +671,11 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="Navigation.IOSNullContextInDidFailProvisionalNavigation"
enum="Boolean" expires_after="M85">
<obsolete>
Removed from code in Jan 2021.
</obsolete>
<owner>ajuma@chromium.org</owner>
<owner>eugenebut@chromium.org</owner>
<owner>gambard@chromium.org</owner>
<summary>
Logged when NavigationContext is null inside -[WKNavigationDelegate
webView:didFailProvisionalNavigation]. If Chrome stopped logging this metric
......
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