Skip to content

Commit

Permalink
[iOS] Be more cautious with pending navigation when cancelling load
Browse files Browse the repository at this point in the history
When a page load is cancelled, the pending navigation shouldn't
necessarly be discarded because another navigation could be the current
pending navigation (if there is a delay).
This CL makes sure to check that the cancelled navigation is the
pending navigation before discarding the pending navigation.

Bug: 1007243
Change-Id: Iae01e31bea3e40ae4ff08f1dbcc4a28c9f70198c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837931
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Eugene But <eugenebut@chromium.org>
Reviewed-by: Ali Juma <ajuma@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702874}
  • Loading branch information
Gauthier Ambard authored and Commit Bot committed Oct 4, 2019
1 parent 6b46d4c commit 79a047d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ios/web/navigation/crw_wk_navigation_handler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,11 @@ - (void)handleCancelledError:(NSError*)error
std::unique_ptr<web::NavigationContextImpl> navigationContext =
[self.navigationStates removeNavigation:navigation];
[self loadCancelled];
self.navigationManagerImpl->DiscardNonCommittedItems();
web::NavigationItemImpl* item = web::GetItemWithUniqueID(
self.navigationManagerImpl, navigationContext.get());
if (self.navigationManagerImpl->GetPendingItem() == item) {
self.navigationManagerImpl->DiscardNonCommittedItems();
}

[self.legacyNativeContentController
handleCancelledErrorForContext:navigationContext.get()];
Expand Down

0 comments on commit 79a047d

Please sign in to comment.