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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
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 <memory> |
34 #include <v8.h> | 35 #include <v8.h> |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 ErrorEvent::ErrorEvent() | 39 ErrorEvent::ErrorEvent() |
39 : m_sanitizedMessage() | 40 : m_sanitizedMessage() |
40 , m_location(SourceLocation::create(String(), 0, 0, nullptr)) | 41 , m_location(SourceLocation::create(String(), 0, 0, nullptr)) |
41 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) | 42 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) |
42 { | 43 { |
43 } | 44 } |
44 | 45 |
45 ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializ
er) | 46 ErrorEvent::ErrorEvent(const AtomicString& type, const ErrorEventInit& initializ
er) |
46 : Event(type, initializer) | 47 : Event(type, initializer) |
47 , m_sanitizedMessage() | 48 , m_sanitizedMessage() |
48 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) | 49 , m_world(DOMWrapperWorld::current(v8::Isolate::GetCurrent())) |
49 { | 50 { |
50 if (initializer.hasMessage()) | 51 if (initializer.hasMessage()) |
51 m_sanitizedMessage = initializer.message(); | 52 m_sanitizedMessage = initializer.message(); |
52 m_location = SourceLocation::create( | 53 m_location = SourceLocation::create( |
53 initializer.hasFilename() ? initializer.filename() : String(), | 54 initializer.hasFilename() ? initializer.filename() : String(), |
54 initializer.hasLineno() ? initializer.lineno() : 0, | 55 initializer.hasLineno() ? initializer.lineno() : 0, |
55 initializer.hasColno() ? initializer.colno() : 0, | 56 initializer.hasColno() ? initializer.colno() : 0, |
56 nullptr); | 57 nullptr); |
57 if (initializer.hasError()) | 58 if (initializer.hasError()) |
58 m_error = initializer.error(); | 59 m_error = initializer.error(); |
59 } | 60 } |
60 | 61 |
61 ErrorEvent::ErrorEvent(const String& message, PassOwnPtr<SourceLocation> locatio
n, DOMWrapperWorld* world) | 62 ErrorEvent::ErrorEvent(const String& message, std::unique_ptr<SourceLocation> lo
cation, DOMWrapperWorld* world) |
62 : Event(EventTypeNames::error, false, true) | 63 : Event(EventTypeNames::error, false, true) |
63 , m_sanitizedMessage(message) | 64 , m_sanitizedMessage(message) |
64 , m_location(std::move(location)) | 65 , m_location(std::move(location)) |
65 , m_world(world) | 66 , m_world(world) |
66 { | 67 { |
67 } | 68 } |
68 | 69 |
69 void ErrorEvent::setUnsanitizedMessage(const String& message) | 70 void ErrorEvent::setUnsanitizedMessage(const String& message) |
70 { | 71 { |
71 ASSERT(m_unsanitizedMessage.isEmpty()); | 72 ASSERT(m_unsanitizedMessage.isEmpty()); |
(...skipping 21 matching lines...) Expand all Loading... |
93 return ScriptValue(); | 94 return ScriptValue(); |
94 return m_error; | 95 return m_error; |
95 } | 96 } |
96 | 97 |
97 DEFINE_TRACE(ErrorEvent) | 98 DEFINE_TRACE(ErrorEvent) |
98 { | 99 { |
99 Event::trace(visitor); | 100 Event::trace(visitor); |
100 } | 101 } |
101 | 102 |
102 } // namespace blink | 103 } // namespace blink |
OLD | NEW |