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

Unified Diff: Source/platform/weborigin/SecurityOrigin.cpp

Issue 1309333004: Reland of Take care of a FIXME in SecurityOrigin.cpp to check the validity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 | Source/platform/weborigin/SecurityOriginTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/weborigin/SecurityOrigin.cpp
diff --git a/Source/platform/weborigin/SecurityOrigin.cpp b/Source/platform/weborigin/SecurityOrigin.cpp
index c979d83d7b2bf463fa237768070d6e553b813264..5404ee5b95b9f9c665feeef3e0c11f9bb9e494a1 100644
--- a/Source/platform/weborigin/SecurityOrigin.cpp
+++ b/Source/platform/weborigin/SecurityOrigin.cpp
@@ -97,19 +97,24 @@
return true;
// FIXME: Do we need to unwrap the URL further?
- KURL innerURL = SecurityOrigin::shouldUseInnerURL(url) ? SecurityOrigin::extractInnerURL(url) : url;
-
- // FIXME: Check whether innerURL is valid.
+ KURL relevantURL;
+ if (SecurityOrigin::shouldUseInnerURL(url)) {
+ relevantURL = SecurityOrigin::extractInnerURL(url);
+ if (!relevantURL.isValid())
+ return true;
+ } else {
+ relevantURL = url;
+ }
// For edge case URLs that were probably misparsed, make sure that the origin is unique.
// FIXME: Do we really need to do this? This looks to be a hack around a
// security bug in CFNetwork that might have been fixed.
- if (schemeRequiresAuthority(innerURL) && innerURL.host().isEmpty())
+ if (schemeRequiresAuthority(relevantURL) && relevantURL.host().isEmpty())
return true;
// SchemeRegistry needs a lower case protocol because it uses HashMaps
// that assume the scheme has already been canonicalized.
- String protocol = innerURL.protocol().lower();
+ String protocol = relevantURL.protocol().lower();
if (SchemeRegistry::shouldTreatURLSchemeAsNoAccess(protocol))
return true;
« no previous file with comments | « no previous file | Source/platform/weborigin/SecurityOriginTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698