| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index 9abe48baba00b2f629cdbe1758e65f34139e8011..57b604705a0d15f97a576c025c29e308c5c97515 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -37,6 +37,7 @@
|
| #include "XMLNames.h"
|
| #include "bindings/v8/CustomElementConstructorBuilder.h"
|
| #include "bindings/v8/Dictionary.h"
|
| +#include "bindings/v8/ExceptionMessages.h"
|
| #include "bindings/v8/ExceptionState.h"
|
| #include "bindings/v8/ExceptionStatePlaceholder.h"
|
| #include "bindings/v8/ScriptController.h"
|
| @@ -3691,7 +3692,7 @@ String Document::domain() const
|
| void Document::setDomain(const String& newDomain, ExceptionState& es)
|
| {
|
| if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(securityOrigin()->protocol())) {
|
| - es.throwDOMException(SecurityError, "'document.domain' assignment is forbidden for the '" + securityOrigin()->protocol() + "' scheme.");
|
| + es.throwSecurityError(ExceptionMessages::failedToSet("domain", "Document", "assignment is forbidden for the '" + securityOrigin()->protocol() + "' scheme."));
|
| return;
|
| }
|
|
|
| @@ -3713,17 +3714,17 @@ void Document::setDomain(const String& newDomain, ExceptionState& es)
|
|
|
| int oldLength = domain().length();
|
| int newLength = newDomain.length();
|
| - String exceptionMessage = "'document.domain' assignment failed: '" + newDomain + "' is not a suffix of '" + domain() + "'.";
|
| + String exceptionMessage = ExceptionMessages::failedToSet("domain", "Document", "'" + newDomain + "' is not a suffix of '" + domain() + "'.");
|
| // e.g. newDomain = subdomain.www.example.com (25) and domain() = www.example.com (15)
|
| if (newLength >= oldLength) {
|
| - es.throwDOMException(SecurityError, exceptionMessage);
|
| + es.throwSecurityError(exceptionMessage);
|
| return;
|
| }
|
|
|
| String test = domain();
|
| // Check that it's a complete suffix, not e.g. "ample.com"
|
| if (test[oldLength - newLength - 1] != '.') {
|
| - es.throwDOMException(SecurityError, exceptionMessage);
|
| + es.throwSecurityError(exceptionMessage);
|
| return;
|
| }
|
|
|
| @@ -3731,7 +3732,7 @@ void Document::setDomain(const String& newDomain, ExceptionState& es)
|
| // and we check that it's the same thing as newDomain
|
| test.remove(0, oldLength - newLength);
|
| if (test != newDomain) {
|
| - es.throwDOMException(SecurityError, exceptionMessage);
|
| + es.throwSecurityError(exceptionMessage);
|
| return;
|
| }
|
|
|
|
|