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, prefer 'sanitizedMessage()' when p resent. |
69 const String& message() const { return !sanitizedMessage().isEmpty() ? sanit izedMessage() : unsanitizedMessage(); } | |
abarth-chromium
2013/08/14 19:42:08
Woah, I don't think we should fall back to the san
| |
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 'unsanitize dMessage()'. | |
75 const String& messageForConsole() const { return !unsanitizedMessage().isEmp ty() ? unsanitizedMessage() : sanitizedMessage(); } | |
abarth-chromium
2013/08/14 19:42:08
Fallback here makes sense.
| |
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 const String& unsanitizedMessage() const { return m_unsanitizedMessage; } |
87 const String& sanitizedMessage() const { return m_sanitizedMessage; } | |
abarth-chromium
2013/08/14 19:42:08
What's the point of these private accessors? Code
| |
88 | |
89 String m_unsanitizedMessage; | |
90 String m_sanitizedMessage; | |
81 String m_fileName; | 91 String m_fileName; |
82 unsigned m_lineNumber; | 92 unsigned m_lineNumber; |
83 unsigned m_columnNumber; | 93 unsigned m_columnNumber; |
84 }; | 94 }; |
85 | 95 |
86 } // namespace WebCore | 96 } // namespace WebCore |
87 | 97 |
88 #endif // ErrorEvent_h | 98 #endif // ErrorEvent_h |
OLD | NEW |