Index: Source/bindings/v8/ExceptionState.cpp |
diff --git a/Source/bindings/v8/ExceptionState.cpp b/Source/bindings/v8/ExceptionState.cpp |
index 6d666b35f3ee4acaf5cc48f0361ed36ac0c9814e..16f0c45b3a34dfbc0f6014b42b8dc260c1e7d1d1 100644 |
--- a/Source/bindings/v8/ExceptionState.cpp |
+++ b/Source/bindings/v8/ExceptionState.cpp |
@@ -31,6 +31,7 @@ |
#include "config.h" |
#include "bindings/v8/ExceptionState.h" |
+#include "bindings/v8/ExceptionMessages.h" |
#include "bindings/v8/V8ThrowException.h" |
#include "core/dom/ExceptionCode.h" |
@@ -50,8 +51,22 @@ void ExceptionState::throwDOMException(const ExceptionCode& ec, const String& me |
// SecurityError is thrown via ::throwSecurityError, and _careful_ consideration must be given to the data exposed to JavaScript via the 'sanitizedMessage'. |
ASSERT(ec != SecurityError); |
+ String processedMessage = message; |
+ if (propertyName() && interfaceName() && m_context != UnknownContext) { |
+ if (m_context == DeletionContext) |
+ processedMessage = ExceptionMessages::failedToDelete(propertyName(), interfaceName(), message); |
+ else if (m_context == ExecutionContext) |
+ processedMessage = ExceptionMessages::failedToExecute(propertyName(), interfaceName(), message); |
+ else if (m_context == GetterContext) |
+ processedMessage = ExceptionMessages::failedToGet(propertyName(), interfaceName(), message); |
+ else if (m_context == SetterContext) |
+ processedMessage = ExceptionMessages::failedToSet(propertyName(), interfaceName(), message); |
+ } else if (!propertyName() && interfaceName() && m_context == ConstructionContext) { |
+ processedMessage = ExceptionMessages::failedToConstruct(interfaceName(), message); |
+ } |
+ |
m_code = ec; |
- setException(V8ThrowException::createDOMException(ec, message, m_creationContext, m_isolate)); |
+ setException(V8ThrowException::createDOMException(ec, processedMessage, m_creationContext, m_isolate)); |
} |
void ExceptionState::throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage) |