[ios] Fix reload when cancelling the first post-restore navigation.
Use GetLastCommittedItemInCurrentOrRestoredSession() instead of
GetLastCommittedItem() so restore session URL's aren't suppressed.
Otherwise a cancelled/stopped navigation during the first post-restore
navigation will always return early from Reload.
Bug: 1050518
Change-Id: I352e430abcf888ae8488150b6511e8a7fd9bd4ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2125870
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: Eugene But <eugenebut@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754648}
diff --git a/ios/web/navigation/navigation_manager_impl.mm b/ios/web/navigation/navigation_manager_impl.mm
index cebcb33..2e30ee7 100644
--- a/ios/web/navigation/navigation_manager_impl.mm
+++ b/ios/web/navigation/navigation_manager_impl.mm
@@ -337,7 +337,12 @@
return;
}
- if (!GetTransientItem() && !GetPendingItem() && !GetLastCommittedItem())
+ // Use GetLastCommittedItemInCurrentOrRestoredSession() instead of
+ // GetLastCommittedItem() so restore session URL's aren't suppressed.
+ // Otherwise a cancelled/stopped navigation during the first post-restore
+ // navigation will always return early from Reload.
+ if (!GetTransientItem() && !GetPendingItem() &&
+ !GetLastCommittedItemInCurrentOrRestoredSession())
return;
delegate_->ClearDialogs();
@@ -357,7 +362,7 @@
else if (GetPendingItem())
reload_item = GetPendingItem();
else
- reload_item = GetLastCommittedItem();
+ reload_item = GetLastCommittedItemInCurrentOrRestoredSession();
DCHECK(reload_item);
reload_item->SetURL(reload_item->GetOriginalRequestURL());