| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "core/events/ErrorEvent.h" | 31 #include "core/events/ErrorEvent.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/V8Binding.h" | 33 #include "bindings/core/v8/V8Binding.h" |
| 34 #include <v8.h> | 34 #include <v8.h> |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 ErrorEvent::ErrorEvent() | 38 ErrorEvent::ErrorEvent() |
| 39 : m_sanitizedMessage() | 39 : m_sanitizedMessage() |
| 40 , m_fileName() | 40 , m_location(SourceLocation::create(String(), 0, 0, nullptr)) |
| 41 , m_lineNumber(0) | |
| 42 , m_columnNumber(0) | |
| 43 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) | 41 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) |
| 44 { | 42 { |
| 45 } | 43 } |
| 46 | 44 |
| 47 ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializ
er) | 45 ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializ
er) |
| 48 : Event(type, initializer) | 46 : Event(type, initializer) |
| 49 , m_sanitizedMessage() | 47 , m_sanitizedMessage() |
| 50 , m_fileName() | |
| 51 , m_lineNumber(0) | |
| 52 , m_columnNumber(0) | |
| 53 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) | 48 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) |
| 54 { | 49 { |
| 55 if (initializer.hasMessage()) | 50 if (initializer.hasMessage()) |
| 56 m_sanitizedMessage = initializer.message(); | 51 m_sanitizedMessage = initializer.message(); |
| 57 if (initializer.hasFilename()) | 52 m_location = SourceLocation::create( |
| 58 m_fileName = initializer.filename(); | 53 initializer.hasFilename() ? initializer.filename() : String(), |
| 59 if (initializer.hasLineno()) | 54 initializer.hasLineno() ? initializer.lineno() : 0, |
| 60 m_lineNumber = initializer.lineno(); | 55 initializer.hasColno() ? initializer.colno() : 0, |
| 61 if (initializer.hasColno()) | 56 nullptr); |
| 62 m_columnNumber = initializer.colno(); | |
| 63 if (initializer.hasError()) | 57 if (initializer.hasError()) |
| 64 m_error = initializer.error(); | 58 m_error = initializer.error(); |
| 65 } | 59 } |
| 66 | 60 |
| 67 ErrorEvent::ErrorEvent(const String& message, const String& fileName, unsigned l
ineNumber, unsigned columnNumber, DOMWrapperWorld* world) | 61 ErrorEvent::ErrorEvent(const String& message, PassOwnPtr<SourceLocation> locatio
n, DOMWrapperWorld* world) |
| 68 : Event(EventTypeNames::error, false, true) | 62 : Event(EventTypeNames::error, false, true) |
| 69 , m_sanitizedMessage(message) | 63 , m_sanitizedMessage(message) |
| 70 , m_fileName(fileName) | 64 , m_location(std::move(location)) |
| 71 , m_lineNumber(lineNumber) | |
| 72 , m_columnNumber(columnNumber) | |
| 73 , m_world(world) | 65 , m_world(world) |
| 74 { | 66 { |
| 75 } | 67 } |
| 76 | 68 |
| 77 void ErrorEvent::setUnsanitizedMessage(const String& message) | 69 void ErrorEvent::setUnsanitizedMessage(const String& message) |
| 78 { | 70 { |
| 79 ASSERT(m_unsanitizedMessage.isEmpty()); | 71 ASSERT(m_unsanitizedMessage.isEmpty()); |
| 80 m_unsanitizedMessage = message; | 72 m_unsanitizedMessage = message; |
| 81 } | 73 } |
| 82 | 74 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 101 return ScriptValue(); | 93 return ScriptValue(); |
| 102 return m_error; | 94 return m_error; |
| 103 } | 95 } |
| 104 | 96 |
| 105 DEFINE_TRACE(ErrorEvent) | 97 DEFINE_TRACE(ErrorEvent) |
| 106 { | 98 { |
| 107 Event::trace(visitor); | 99 Event::trace(visitor); |
| 108 } | 100 } |
| 109 | 101 |
| 110 } // namespace blink | 102 } // namespace blink |
| OLD | NEW |