| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 static DOMException* create(ExceptionCode, | 48 static DOMException* create(ExceptionCode, |
| 49 const String& sanitizedMessage = String(), | 49 const String& sanitizedMessage = String(), |
| 50 const String& unsanitizedMessage = String()); | 50 const String& unsanitizedMessage = String()); |
| 51 | 51 |
| 52 // Constructor exposed to script. | 52 // Constructor exposed to script. |
| 53 static DOMException* create(const String& message, const String& name); | 53 static DOMException* create(const String& message, const String& name); |
| 54 | 54 |
| 55 unsigned short code() const { return m_code; } | 55 unsigned short code() const { return m_code; } |
| 56 String name() const { return m_name; } | 56 String name() const { return m_name; } |
| 57 | 57 |
| 58 // This is the message that's exposed to JavaScript: never return unsanitized
data. | 58 // This is the message that's exposed to JavaScript: never return unsanitized |
| 59 // data. |
| 59 String message() const { return m_sanitizedMessage; } | 60 String message() const { return m_sanitizedMessage; } |
| 60 String toString() const; | 61 String toString() const; |
| 61 | 62 |
| 62 // This is the message that's exposed to the console: if an unsanitized messag
e is present, we prefer it. | 63 // This is the message that's exposed to the console: if an unsanitized |
| 64 // message is present, we prefer it. |
| 63 String messageForConsole() const { | 65 String messageForConsole() const { |
| 64 return !m_unsanitizedMessage.isEmpty() ? m_unsanitizedMessage | 66 return !m_unsanitizedMessage.isEmpty() ? m_unsanitizedMessage |
| 65 : m_sanitizedMessage; | 67 : m_sanitizedMessage; |
| 66 } | 68 } |
| 67 String toStringForConsole() const; | 69 String toStringForConsole() const; |
| 68 | 70 |
| 69 static String getErrorName(ExceptionCode); | 71 static String getErrorName(ExceptionCode); |
| 70 static String getErrorMessage(ExceptionCode); | 72 static String getErrorMessage(ExceptionCode); |
| 71 | 73 |
| 72 DEFINE_INLINE_TRACE() {} | 74 DEFINE_INLINE_TRACE() {} |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 DOMException(unsigned short m_code, | 77 DOMException(unsigned short m_code, |
| 76 const String& name, | 78 const String& name, |
| 77 const String& sanitizedMessage, | 79 const String& sanitizedMessage, |
| 78 const String& unsanitizedMessage); | 80 const String& unsanitizedMessage); |
| 79 | 81 |
| 80 unsigned short m_code; | 82 unsigned short m_code; |
| 81 String m_name; | 83 String m_name; |
| 82 String m_sanitizedMessage; | 84 String m_sanitizedMessage; |
| 83 String m_unsanitizedMessage; | 85 String m_unsanitizedMessage; |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace blink | 88 } // namespace blink |
| 87 | 89 |
| 88 #endif // DOMException_h | 90 #endif // DOMException_h |
| OLD | NEW |