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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2447293002: Don't call lower() on KURL protocol/host (Closed)
Patch Set: add canonicalization layout test Created 4 years, 2 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: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 324caf8eb8f7de97b3dda5d1b10fbd2ae0668579..f58bf3d257b9ed4a2890a16af1eb1db10934fa81 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4379,7 +4379,7 @@ String Document::domain() const {
return getSecurityOrigin()->domain();
}
-void Document::setDomain(const String& newDomain,
+void Document::setDomain(const String& rawDomain,
ExceptionState& exceptionState) {
UseCounter::count(*this, UseCounter::DocumentSetDomain);
@@ -4397,6 +4397,14 @@ void Document::setDomain(const String& newDomain,
return;
}
+ bool success = false;
+ String newDomain = SecurityOrigin::canonicalizeHost(rawDomain, &success);
+ if (!success) {
+ exceptionState.throwSecurityError("'" + rawDomain +
+ "' could not be parsed properly.");
+ return;
+ }
+
if (newDomain.isEmpty()) {
exceptionState.throwSecurityError("'" + newDomain +
"' is an empty domain.");

Powered by Google App Engine
This is Rietveld 408576698