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; |