Commit 4c3e1c10 authored by Yi Su's avatar Yi Su Committed by Commit Bot

Remove legacy check on null NavigationItem in CRWWKNavigationHandler

Now that pending NavigationItem are stored in NavigationContext, it
will never be null. Remove the legacy code that checks if pending
NavigationItem exists in CRWWKNavigationHandler.

Bug: 925304
Change-Id: I5eb541f068b4a6db1f5322fed2e7318d686a845a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730424
Commit-Queue: Yi Su <mrsuyi@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683507}
parent f8d12991
......@@ -777,35 +777,7 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
// |context| will be nil if this navigation has been already committed and
// finished.
if (context) {
web::NavigationManager* navigationManager =
self.webStateImpl->GetNavigationManager();
GURL pendingURL;
if (navigationManager->GetPendingItemIndex() == -1) {
if (context->GetItem()) {
// Item may not exist if navigation was stopped (see
// crbug.com/969915).
pendingURL = context->GetItem()->GetURL();
}
} else {
if (navigationManager->GetPendingItem()) {
pendingURL = navigationManager->GetPendingItem()->GetURL();
}
}
if ((pendingURL == webViewURL) || (context->IsLoadingHtmlString()) ||
(!web::GetWebClient()->IsSlimNavigationManagerEnabled() &&
ui::PageTransitionCoreTypeIs(context->GetPageTransition(),
ui::PAGE_TRANSITION_RELOAD) &&
navigationManager->GetLastCommittedItem())) {
// Commit navigation if at least one of these is true:
// - Navigation has pending item (this should always be true, but
// pending item may not exist due to crbug.com/925304).
// - Navigation is loadHTMLString:baseURL: navigation, which does not
// create a pending item, but modifies committed item instead.
// - Transition type is reload with Legacy Navigation Manager (Legacy
// Navigation Manager does not create pending item for reload due to
// crbug.com/676129)
context->SetHasCommitted(true);
}
self.webStateImpl->SetContentsMimeType(
base::SysNSStringToUTF8(context->GetMimeType()));
}
......@@ -2070,12 +2042,6 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
// Updates the WKBackForwardListItemHolder navigation item.
- (void)updateCurrentBackForwardListItemHolderInWebView:(WKWebView*)webView {
if (!self.currentNavItem) {
// TODO(crbug.com/925304): Pending item (which stores the holder) should be
// owned by NavigationContext object. Pending item should never be null.
return;
}
web::WKBackForwardListItemHolder* holder =
self.currentBackForwardListItemHolder;
......@@ -2217,9 +2183,7 @@ void ReportOutOfSyncURLInDidStartProvisionalNavigation(
// be extracted from the landing page.)
web::NavigationItem* currentItem = self.currentNavItem;
// TODO(crbug.com/925304): Pending item (which should be used here) should be
// owned by NavigationContext object. Pending item should never be null.
if (currentItem && !currentItem->GetReferrer().url.is_valid()) {
if (!currentItem->GetReferrer().url.is_valid()) {
currentItem->SetReferrer(referrer);
}
......
......@@ -311,7 +311,7 @@ ACTION_P5(VerifyDataFinishedContext,
PageTransitionCoreTypeIs(ui::PageTransition::PAGE_TRANSITION_TYPED,
(*context)->GetPageTransition()));
EXPECT_FALSE((*context)->IsSameDocument());
EXPECT_FALSE((*context)->HasCommitted());
EXPECT_TRUE((*context)->HasCommitted());
EXPECT_FALSE((*context)->IsDownload());
EXPECT_FALSE((*context)->IsPost());
EXPECT_FALSE((*context)->GetError());
......
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