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

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

Issue 2918013002: Do not rewrite about urls to chrome:// for cetain renderer-initated loads (Closed)
Patch Set: Self review Created 3 years, 7 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 | « ios/web/navigation/navigation_manager_impl_unittest.mm ('k') | 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 ccd31a039220858dec9b95c4540a465aae73177c..edc3f53d1e78f8c322f74ce8e5c246ea0f83404a 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -1266,14 +1266,7 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
- (GURL)currentURLWithTrustLevel:(web::URLVerificationTrustLevel*)trustLevel {
DCHECK(trustLevel) << "Verification of the trustLevel state is mandatory";
if (_webView) {
- GURL url([self webURLWithTrustLevel:trustLevel]);
- // Web views treat all about: URLs as the same origin, which makes it
- // possible for pages to document.write into about:<foo> pages, where <foo>
- // can be something misleading. Report any about: URL as about:blank to
- // prevent that. See crbug.com/326118
- if (url.scheme() == url::kAboutScheme)
- return GURL(url::kAboutBlankURL);
- return url;
+ return [self webURLWithTrustLevel:trustLevel];
}
// Any non-web URL source is trusted.
*trustLevel = web::URLVerificationTrustLevel::kAbsolute;
@@ -2141,7 +2134,10 @@ registerLoadRequestForURL:(const GURL&)requestURL
![[_navigationStates lastAddedNavigation] isEqual:navigation] ||
// invalid URL load
(!_lastRegisteredRequestURL.is_valid() &&
- _documentURL.spec() == url::kAboutBlankURL))
+ _documentURL.spec() == url::kAboutBlankURL) ||
+ // about URL was changed by WebKit (e.g. about:newtab -> about:blank)
+ (_lastRegisteredRequestURL.scheme() == url::kAboutScheme &&
+ currentURL.spec() == url::kAboutBlankURL))
<< std::endl
<< "currentURL = [" << currentURL << "]" << std::endl
<< "_lastRegisteredRequestURL = [" << _lastRegisteredRequestURL << "]";
« no previous file with comments | « ios/web/navigation/navigation_manager_impl_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698