OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 #include "config.h" | 6 #include "config.h" |
7 #include "core/events/PromiseRejectionEvent.h" | 7 #include "core/events/PromiseRejectionEvent.h" |
8 | 8 |
9 #include "bindings/core/v8/DOMWrapperWorld.h" | 9 #include "bindings/core/v8/DOMWrapperWorld.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (m_reason.isEmpty() || !m_scriptState || !m_scriptState->contextIsValid()
|| m_scriptState->world().worldId() != state->world().worldId()) | 46 if (m_reason.isEmpty() || !m_scriptState || !m_scriptState->contextIsValid()
|| m_scriptState->world().worldId() != state->world().worldId()) |
47 return ScriptValue(state, v8::Null(state->isolate())); | 47 return ScriptValue(state, v8::Null(state->isolate())); |
48 return ScriptValue(m_scriptState.get(), m_reason.newLocal(m_scriptState->iso
late())); | 48 return ScriptValue(m_scriptState.get(), m_reason.newLocal(m_scriptState->iso
late())); |
49 } | 49 } |
50 | 50 |
51 const AtomicString& PromiseRejectionEvent::interfaceName() const | 51 const AtomicString& PromiseRejectionEvent::interfaceName() const |
52 { | 52 { |
53 return EventNames::PromiseRejectionEvent; | 53 return EventNames::PromiseRejectionEvent; |
54 } | 54 } |
55 | 55 |
| 56 bool PromiseRejectionEvent::canBeDispatchedInWorld(const DOMWrapperWorld& world)
const |
| 57 { |
| 58 return m_scriptState && m_scriptState->contextIsValid() && m_scriptState->wo
rld().worldId() == world.worldId(); |
| 59 } |
| 60 |
56 DEFINE_TRACE(PromiseRejectionEvent) | 61 DEFINE_TRACE(PromiseRejectionEvent) |
57 { | 62 { |
58 Event::trace(visitor); | 63 Event::trace(visitor); |
59 } | 64 } |
60 | 65 |
61 void PromiseRejectionEvent::didCollectPromise(const v8::WeakCallbackInfo<Promise
RejectionEvent>& data) | 66 void PromiseRejectionEvent::didCollectPromise(const v8::WeakCallbackInfo<Promise
RejectionEvent>& data) |
62 { | 67 { |
63 data.GetParameter()->m_promise.clear(); | 68 data.GetParameter()->m_promise.clear(); |
64 } | 69 } |
65 | 70 |
66 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR
ejectionEvent>& data) | 71 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR
ejectionEvent>& data) |
67 { | 72 { |
68 data.GetParameter()->m_reason.clear(); | 73 data.GetParameter()->m_reason.clear(); |
69 } | 74 } |
70 | 75 |
71 } // namespace blink | 76 } // namespace blink |
OLD | NEW |