Index: Source/core/dom/DOMException.h |
diff --git a/Source/core/dom/DOMException.h b/Source/core/dom/DOMException.h |
index ca96483b507e852dc1697effc8f3ae8dfea6a799..9e1f103eb997987bcf78457a3c8afd2880b093af 100644 |
--- a/Source/core/dom/DOMException.h |
+++ b/Source/core/dom/DOMException.h |
@@ -40,24 +40,34 @@ typedef int ExceptionCode; |
class DOMException : public RefCounted<DOMException>, public ScriptWrappable { |
public: |
- static PassRefPtr<DOMException> create(ExceptionCode, const String& message = String()); |
+ static PassRefPtr<DOMException> create(ExceptionCode, const String& sanitizedMessage = String(), const String& unsanitizedMessage = String()); |
unsigned short code() const { return m_code; } |
String name() const { return m_name; } |
- String message() const { return m_message; } |
+ // This is the message that's exposed to JavaScript: if a sanitized message is present, we prefer it. |
+ String message() const { return !sanitizedMessage().isEmpty() ? sanitizedMessage() : unsanitizedMessage(); } |
String toString() const; |
+ // This is the message that's exposed to the console: if an unsanitized message is present, we prefer it. |
+ String messageForConsole() const { return !unsanitizedMessage().isEmpty() ? unsanitizedMessage() : sanitizedMessage(); } |
+ String toStringForConsole() const; |
+ |
static String getErrorName(ExceptionCode); |
static String getErrorMessage(ExceptionCode); |
static unsigned short getLegacyErrorCode(ExceptionCode); |
private: |
- DOMException(unsigned short m_code, const String& name, const String& message); |
+ DOMException(unsigned short m_code, const String& name, const String& sanitizedMessage, const String& unsanitizedMessage); |
+ |
+ // These methods are not (and must not be) exposed to JavaScript. |
+ String unsanitizedMessage() const { return m_unsanitizedMessage; } |
+ String sanitizedMessage() const { return m_sanitizedMessage; } |
unsigned short m_code; |
String m_name; |
- String m_message; |
+ String m_sanitizedMessage; |
+ String m_unsanitizedMessage; |
}; |
} // namespace WebCore |