| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return adoptRefWillBeNoop(new ErrorEvent(message, fileName, lineNumber,
columnNumber, world)); | 51 return adoptRefWillBeNoop(new ErrorEvent(message, fileName, lineNumber,
columnNumber, world)); |
| 52 } | 52 } |
| 53 static PassRefPtrWillBeRawPtr<ErrorEvent> create(const AtomicString& type, c
onst ErrorEventInit& initializer) | 53 static PassRefPtrWillBeRawPtr<ErrorEvent> create(const AtomicString& type, c
onst ErrorEventInit& initializer) |
| 54 { | 54 { |
| 55 return adoptRefWillBeNoop(new ErrorEvent(type, initializer)); | 55 return adoptRefWillBeNoop(new ErrorEvent(type, initializer)); |
| 56 } | 56 } |
| 57 static PassRefPtrWillBeRawPtr<ErrorEvent> createSanitizedError(DOMWrapperWor
ld* world) | 57 static PassRefPtrWillBeRawPtr<ErrorEvent> createSanitizedError(DOMWrapperWor
ld* world) |
| 58 { | 58 { |
| 59 return adoptRefWillBeNoop(new ErrorEvent("Script error.", String(), 0, 0
, world)); | 59 return adoptRefWillBeNoop(new ErrorEvent("Script error.", String(), 0, 0
, world)); |
| 60 } | 60 } |
| 61 virtual ~ErrorEvent(); | 61 ~ErrorEvent() override; |
| 62 | 62 |
| 63 // As 'message' is exposed to JavaScript, never return unsanitizedMessage. | 63 // As 'message' is exposed to JavaScript, never return unsanitizedMessage. |
| 64 const String& message() const { return m_sanitizedMessage; } | 64 const String& message() const { return m_sanitizedMessage; } |
| 65 const String& filename() const { return m_fileName; } | 65 const String& filename() const { return m_fileName; } |
| 66 unsigned lineno() const { return m_lineNumber; } | 66 unsigned lineno() const { return m_lineNumber; } |
| 67 unsigned colno() const { return m_columnNumber; } | 67 unsigned colno() const { return m_columnNumber; } |
| 68 ScriptValue error(ScriptState*) const; | 68 ScriptValue error(ScriptState*) const; |
| 69 | 69 |
| 70 // 'messageForConsole' is not exposed to JavaScript, and prefers 'm_unsaniti
zedMessage'. | 70 // 'messageForConsole' is not exposed to JavaScript, and prefers 'm_unsaniti
zedMessage'. |
| 71 const String& messageForConsole() const { return !m_unsanitizedMessage.isEmp
ty() ? m_unsanitizedMessage : m_sanitizedMessage; } | 71 const String& messageForConsole() const { return !m_unsanitizedMessage.isEmp
ty() ? m_unsanitizedMessage : m_sanitizedMessage; } |
| 72 | 72 |
| 73 virtual const AtomicString& interfaceName() const override; | 73 const AtomicString& interfaceName() const override; |
| 74 | 74 |
| 75 DOMWrapperWorld* world() const { return m_world.get(); } | 75 DOMWrapperWorld* world() const { return m_world.get(); } |
| 76 | 76 |
| 77 void setUnsanitizedMessage(const String&); | 77 void setUnsanitizedMessage(const String&); |
| 78 | 78 |
| 79 DECLARE_VIRTUAL_TRACE(); | 79 DECLARE_VIRTUAL_TRACE(); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 ErrorEvent(); | 82 ErrorEvent(); |
| 83 ErrorEvent(const String& message, const String& fileName, unsigned lineNumbe
r, unsigned columnNumber, DOMWrapperWorld*); | 83 ErrorEvent(const String& message, const String& fileName, unsigned lineNumbe
r, unsigned columnNumber, DOMWrapperWorld*); |
| 84 ErrorEvent(const AtomicString&, const ErrorEventInit&); | 84 ErrorEvent(const AtomicString&, const ErrorEventInit&); |
| 85 | 85 |
| 86 String m_unsanitizedMessage; | 86 String m_unsanitizedMessage; |
| 87 String m_sanitizedMessage; | 87 String m_sanitizedMessage; |
| 88 String m_fileName; | 88 String m_fileName; |
| 89 unsigned m_lineNumber; | 89 unsigned m_lineNumber; |
| 90 unsigned m_columnNumber; | 90 unsigned m_columnNumber; |
| 91 ScriptValue m_error; | 91 ScriptValue m_error; |
| 92 | 92 |
| 93 RefPtr<DOMWrapperWorld> m_world; | 93 RefPtr<DOMWrapperWorld> m_world; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace blink | 96 } // namespace blink |
| 97 | 97 |
| 98 #endif // ErrorEvent_h | 98 #endif // ErrorEvent_h |
| OLD | NEW |