Commit 1309f689 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Disable offline mode fix for SlimNav on iOS13.

On iOS 12 airplane mode back/forward navigations between restored session
entries are same-document navigattions and were not triggering onload()
or onpopstate() redirect to the actual target URL.  As a workaround
a reload is triggered.

It appears this work-around isn't necessary on iOS13.

TEST=Visit techmeme, wikipedia + a few articles, tab grid, close all, restore, airplane mode, back to tab, tap back to beginning.

Bug: 995363
Change-Id: I0fcd6ad8ce5172b4808030c4cee0166289e6e22c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757298
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688331}
parent c1e6cfe5
...@@ -144,19 +144,23 @@ using web::wk_navigation_util::IsPlaceholderUrl; ...@@ -144,19 +144,23 @@ using web::wk_navigation_util::IsPlaceholderUrl;
// not fire 'pageshow', 'onload', 'popstate' or any of the // not fire 'pageshow', 'onload', 'popstate' or any of the
// WKNavigationDelegate callbacks for back/forward navigation from an about: // WKNavigationDelegate callbacks for back/forward navigation from an about:
// scheme placeholder URL to another entry or if either of the redirect fails // scheme placeholder URL to another entry or if either of the redirect fails
// to load (e.g. in airplane mode). Loading state KVO is the only observable // to load (e.g. in airplane mode, <iOS13). Loading state KVO is the only
// event in this scenario, so force a reload to trigger redirect from // observable event in this scenario, so force a reload to trigger redirect
// restore_session.html to the restored URL. // from restore_session.html to the restored URL.
bool previousURLHasAboutScheme = bool previousURLHasAboutScheme =
self.documentURL.SchemeIs(url::kAboutScheme) || self.documentURL.SchemeIs(url::kAboutScheme) ||
IsPlaceholderUrl(self.documentURL) || IsPlaceholderUrl(self.documentURL) ||
web::GetWebClient()->IsAppSpecificURL(self.documentURL); web::GetWebClient()->IsAppSpecificURL(self.documentURL);
bool is_back_forward_navigation = bool needs_back_forward_navigation_reload =
existingContext && existingContext &&
(existingContext->GetPageTransition() & ui::PAGE_TRANSITION_FORWARD_BACK); (existingContext->GetPageTransition() & ui::PAGE_TRANSITION_FORWARD_BACK);
// The back-forward workaround isn't need on iOS13.
if (@available(iOS 13, *)) {
needs_back_forward_navigation_reload = false;
}
if (web::GetWebClient()->IsSlimNavigationManagerEnabled() && if (web::GetWebClient()->IsSlimNavigationManagerEnabled() &&
IsRestoreSessionUrl(webViewURL)) { IsRestoreSessionUrl(webViewURL)) {
if (previousURLHasAboutScheme || is_back_forward_navigation) { if (previousURLHasAboutScheme || needs_back_forward_navigation_reload) {
[self.webView reload]; [self.webView reload];
self.navigationHandler.navigationState = self.navigationHandler.navigationState =
web::WKNavigationState::REQUESTED; web::WKNavigationState::REQUESTED;
......
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