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

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

Issue 2086333003: [ios] Do not commit invalid URLs during web load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow invalid URL to be pending but fix it before committing 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 46f58a99d38b930473c906f141c9b23ab8718030..b886c699a6990c67e09ef077fb9b501db18288f4 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -2290,7 +2290,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 << "]";
@@ -5095,7 +5099,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".
kkhorimoto 2016/06/22 22:20:54 Should we add a DCHECK to ensure that it's about:b
Eugene But (OOO till 7-30) 2016/06/22 22:48:25 1.) DCHECK below covers that case. 2) I don't thin
kkhorimoto 2016/06/23 23:06:22 Yeah, I checked it out and it looks like all clien
+ [[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