Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1300)

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2225943002: [ios] Purge web view if external app URL is current in navigation stack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 6c926c06c7b6927f29403a948152e5f75f48c778..be0d8c44789dcac79a215e5d5686b6649ad04105 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -3343,6 +3343,17 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
if ([self isMainFrameNavigationAction:action])
[self stopLoading];
+ // Purge web view if last committed URL is different from the document URL.
+ // This can happen if external URL was added to the navigation stack and was
+ // loaded using Go Back or Go Forward navigation (in which case document URL
+ // will point to the previous page).
+ GURL lastCommittedURL =
+ self.webState->GetNavigationManager()->GetLastCommittedItem()->GetURL();
+ if (lastCommittedURL != _documentURL) {
+ [self requirePageReconstruction];
+ [self setDocumentURL:lastCommittedURL];
+ }
+
if ([_delegate openExternalURL:requestURL
linkClicked:isNavigationTypeLinkActivated]) {
// Record the URL so that errors reported following the 'NO' reply can be
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698