Commit 038bf28a authored by Danyao Wang's avatar Danyao Wang Committed by Commit Bot

[Nav Experiment] Defer loading URL if web usage is not enabled.

The SlimNav experiment is hitting the CHECK(_webUsageEnabled) in
-ensureWebViewCreatedWithConfiguration when loading placeholder
URL while web usage is disabled. One cause for this situation is when
clearing website data while an interstitial is presented over a native
view. WebInterstitialImpl::DontProceed() is called after web usage is
disabled and it triggers the reload of the native view, which in turn
triggers the placeholder load. Deferring the load fixes the problem,
because the web view is recreated immediately after.

Other causes for placeholder load when web usage is disabled exist, but
the causes are not fully understood. This CL fixes the crashes in these
cases as well. This should uncover behavior changes, that hopefully give
us more details to fix the root cause later.

A downstream egtest for the interstitial case is added in
http://chrome-internal-review.googlesource.com/c/chrome/ios_internal/+/654301

Bug: 865985
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I03d928ce82d128c2f67f36e204731576e479d497
Reviewed-on: https://chromium-review.googlesource.com/1145725Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Danyao Wang <danyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577174}
parent 789766a2
...@@ -1915,6 +1915,15 @@ registerLoadRequestForURL:(const GURL&)requestURL ...@@ -1915,6 +1915,15 @@ registerLoadRequestForURL:(const GURL&)requestURL
if (!_containerView) if (!_containerView)
return; return;
// WKBasedNavigationManagerImpl requires web usage to be enabled to load any
// URL. So bail if web usage is disabled, and let the URL be loaded when web
// usage is enabled again. This can happen when purging web pages when an
// interstitial is presented over a native view. See https://crbug.com/865985
// for details.
if (web::GetWebClient()->IsSlimNavigationManagerEnabled() &&
!_webUsageEnabled)
return;
_currentURLLoadWasTrigerred = YES; _currentURLLoadWasTrigerred = YES;
// Reset current WebUI if one exists. // Reset current WebUI if one exists.
......
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