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

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

Issue 299253003: [webcrypto] Only allow crypto.subtle.* to be used from "secure origins". (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: reformat comments Created 6 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
Index: Source/platform/weborigin/SecurityOrigin.cpp
diff --git a/Source/platform/weborigin/SecurityOrigin.cpp b/Source/platform/weborigin/SecurityOrigin.cpp
index 652560af325dcf8ba1f0ae4a4f97b609654b7ef5..441cd116e3d0fbad21b9289b42a7df2449b55a08 100644
--- a/Source/platform/weborigin/SecurityOrigin.cpp
+++ b/Source/platform/weborigin/SecurityOrigin.cpp
@@ -375,6 +375,23 @@ bool SecurityOrigin::canDisplay(const KURL& url) const
return true;
}
+bool SecurityOrigin::canAccessFeatureRequiringSecureOrigin() const
+{
+ if (isLocal())
+ return true;
+
+ if (SchemeRegistry::shouldTreatURLSchemeAsSecure(m_protocol))
+ return true;
+
+ // FIXME: The localhost check should be more relaxed and
+ // allow all of 127/8 and ::1/128. See:
+ // https://code.google.com/p/chromium/issues/detail?id=362214
+ if (!m_protocol.isEmpty() && !m_domainWasSetInDOM && (m_domain == "localhost" || m_domain == "127.0.0.1" || m_domain == "[::1]"))
+ return true;
+
+ return false;
+}
+
SecurityOrigin::Policy SecurityOrigin::canShowNotifications() const
{
if (m_universalAccess)

Powered by Google App Engine
This is Rietveld 408576698