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

Unified Diff: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp

Issue 2151473002: Small improvements to MixedContentChecker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a TODO to SecurityOrigin::isLocalhost Created 4 years, 5 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 | third_party/WebKit/Source/platform/network/NetworkUtils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
diff --git a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
index 7e93384f0b99cea593cc969970e56594e8cf159b..639a7fd273737b48434ac3b0496d3774e76f56d4 100644
--- a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
+++ b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
@@ -88,13 +88,14 @@ bool MixedContentChecker::isMixedContent(SecurityOrigin* securityOrigin, const K
if (!SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent(securityOrigin->protocol()))
return false;
- // |url| is mixed content if its origin is not potentially trustworthy, and
- // its protocol is not 'data'. We do a quick check against `SecurityOrigin::isSecure`
- // to catch things like `about:blank`, which cannot be sanely passed into
+ // |url| is mixed content if its origin is not potentially trustworthy nor
+ // secure. We do a quick check against `SecurityOrigin::isSecure` to catch
+ // things like `about:blank`, which cannot be sanely passed into
// `SecurityOrigin::create` (as their origin depends on their context).
- bool isAllowed = url.protocolIsData() || SecurityOrigin::isSecure(url) || SecurityOrigin::create(url)->isPotentiallyTrustworthy();
- // TODO(mkwst): Remove this once 'localhost' is no longer considered potentially trustworthy:
- if (isAllowed && url.protocolIs("http") && url.host() == "localhost")
+ bool isAllowed = SecurityOrigin::isSecure(url) || SecurityOrigin::create(url)->isPotentiallyTrustworthy();
+ // TODO(mkwst): Remove this once 'localhost' is no longer considered
+ // potentially trustworthy.
+ if (isAllowed && url.protocolIs("http") && NetworkUtils::isLocalHostname(url.host(), nullptr))
isAllowed = false;
return !isAllowed;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/network/NetworkUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698