| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 static PassRefPtr<ErrorEvent> create(const AtomicString& type, const ErrorEv
entInit& initializer) | 58 static PassRefPtr<ErrorEvent> create(const AtomicString& type, const ErrorEv
entInit& initializer) |
| 59 { | 59 { |
| 60 return adoptRef(new ErrorEvent(type, initializer)); | 60 return adoptRef(new ErrorEvent(type, initializer)); |
| 61 } | 61 } |
| 62 static PassRefPtr<ErrorEvent> createSanitizedError() | 62 static PassRefPtr<ErrorEvent> createSanitizedError() |
| 63 { | 63 { |
| 64 return adoptRef(new ErrorEvent("Script error.", String(), 0, 0)); | 64 return adoptRef(new ErrorEvent("Script error.", String(), 0, 0)); |
| 65 } | 65 } |
| 66 virtual ~ErrorEvent(); | 66 virtual ~ErrorEvent(); |
| 67 | 67 |
| 68 const String& message() const { return m_message; } | 68 // As 'message' is exposed to JavaScript, never return unsanitizedMessage. |
| 69 const String& message() const { return m_sanitizedMessage; } |
| 69 const String& filename() const { return m_fileName; } | 70 const String& filename() const { return m_fileName; } |
| 70 unsigned lineno() const { return m_lineNumber; } | 71 unsigned lineno() const { return m_lineNumber; } |
| 71 unsigned colno() const { return m_columnNumber; } | 72 unsigned colno() const { return m_columnNumber; } |
| 72 | 73 |
| 74 // 'messageForConsole' is not exposed to JavaScript, and prefers 'm_unsaniti
zedMessage'. |
| 75 const String& messageForConsole() const { return !m_unsanitizedMessage.isEmp
ty() ? m_unsanitizedMessage : m_sanitizedMessage; } |
| 76 |
| 73 virtual const AtomicString& interfaceName() const; | 77 virtual const AtomicString& interfaceName() const; |
| 74 | 78 |
| 79 void setUnsanitizedMessage(const String&); |
| 80 |
| 75 private: | 81 private: |
| 76 ErrorEvent(); | 82 ErrorEvent(); |
| 77 ErrorEvent(const String& message, const String& fileName, unsigned lineNumbe
r, unsigned columnNumber); | 83 ErrorEvent(const String& message, const String& fileName, unsigned lineNumbe
r, unsigned columnNumber); |
| 78 ErrorEvent(const AtomicString&, const ErrorEventInit&); | 84 ErrorEvent(const AtomicString&, const ErrorEventInit&); |
| 79 | 85 |
| 80 String m_message; | 86 String m_unsanitizedMessage; |
| 87 String m_sanitizedMessage; |
| 81 String m_fileName; | 88 String m_fileName; |
| 82 unsigned m_lineNumber; | 89 unsigned m_lineNumber; |
| 83 unsigned m_columnNumber; | 90 unsigned m_columnNumber; |
| 84 }; | 91 }; |
| 85 | 92 |
| 86 } // namespace WebCore | 93 } // namespace WebCore |
| 87 | 94 |
| 88 #endif // ErrorEvent_h | 95 #endif // ErrorEvent_h |
| OLD | NEW |