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

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

Issue 2096023002: [ios] Do not commit invalid URLs during web load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 bcd1bba6d348aebe42b8074828c050cbde459f68..f6ab7efa8c4f993d56b8321e5d24cf7621c97827 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -2275,7 +2275,11 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
[self optOutScrollsToTopForSubviews];
// Ensure the URL is as expected (and already reported to the delegate).
- DCHECK(currentURL == _lastRegisteredRequestURL)
+ // If |_lastRegisteredRequestURL| is invalid then |currentURL| will be
+ // "about:blank".
+ DCHECK((currentURL == _lastRegisteredRequestURL) ||
+ (!_lastRegisteredRequestURL.is_valid() &&
+ _documentURL.spec() == url::kAboutBlankURL))
<< std::endl
<< "currentURL = [" << currentURL << "]" << std::endl
<< "_lastRegisteredRequestURL = [" << _lastRegisteredRequestURL << "]";
@@ -5054,7 +5058,17 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
// This is the point where the document's URL has actually changed, and
// pending navigation information should be applied to state information.
[self setDocumentURL:net::GURLWithNSURL([_webView URL])];
- DCHECK(_documentURL == _lastRegisteredRequestURL);
+
+ if (!_lastRegisteredRequestURL.is_valid() &&
+ _documentURL != _lastRegisteredRequestURL) {
+ // if |_lastRegisteredRequestURL| is an invalid URL, then |_documentURL|
+ // will be "about:blank".
+ [[self sessionController] updatePendingEntry:_documentURL];
+ }
+ DCHECK(_documentURL == _lastRegisteredRequestURL ||
+ (!_lastRegisteredRequestURL.is_valid() &&
+ _documentURL.spec() == url::kAboutBlankURL));
+
self.webStateImpl->OnNavigationCommitted(_documentURL);
[self commitPendingNavigationInfo];
if ([self currentBackForwardListItemHolder]->navigation_type() ==
« 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