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

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

Issue 54053006: Move weborigin/ under platform/ so that it may someday call platform APIs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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/OriginAccessEntry.cpp
diff --git a/Source/weborigin/OriginAccessEntry.cpp b/Source/platform/weborigin/OriginAccessEntry.cpp
similarity index 85%
rename from Source/weborigin/OriginAccessEntry.cpp
rename to Source/platform/weborigin/OriginAccessEntry.cpp
index cc677f52b9a0804c4af7a68efaaa1c5f0f9bba18..a9ef7b435447f0d04a4a296cbf0f9a5a81ce88e3 100644
--- a/Source/weborigin/OriginAccessEntry.cpp
+++ b/Source/platform/weborigin/OriginAccessEntry.cpp
@@ -29,9 +29,13 @@
*/
#include "config.h"
-#include "weborigin/OriginAccessEntry.h"
+#include "platform/weborigin/OriginAccessEntry.h"
-#include "weborigin/SecurityOrigin.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebPublicSuffixList.h"
+#include "public/platform/WebString.h"
+#include "platform/weborigin/SecurityOrigin.h"
+#include "wtf/text/WTFString.h"
namespace WebCore {
@@ -71,6 +75,12 @@ bool OriginAccessEntry::matchesOrigin(const SecurityOrigin& origin) const
if (m_hostIsIPAddress && m_ipAddressSettings == TreatIPAddressAsIPAddress)
return false;
+ // Don't allow top-level domains, either with or without an additional dot.
+ if (WebKit::WebPublicSuffixList* suffixList = WebKit::Platform::current()->publicSuffixList()) {
+ if (origin.host().length() <= suffixList->getPublicSuffixLength(origin.host()) + 1)
+ return false;
+ }
+
// Match subdomains.
if (origin.host().length() > m_host.length() && origin.host()[origin.host().length() - m_host.length() - 1] == '.' && origin.host().endsWith(m_host))
return true;

Powered by Google App Engine
This is Rietveld 408576698