Chromium Code Reviews| 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."); |
|
Mike West
2016/10/27 07:30:35
Can you add a layout test that runs through `docum
|
| + return; |
| + } |
| + |
| if (newDomain.isEmpty()) { |
| exceptionState.throwSecurityError("'" + newDomain + |
| "' is an empty domain."); |