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 30 matching lines...) Expand all Loading... | |
41 } | 41 } |
42 | 42 |
43 ScriptValue PromiseRejectionEvent::reason(ScriptState* state) const | 43 ScriptValue PromiseRejectionEvent::reason(ScriptState* state) const |
44 { | 44 { |
45 // Return null when the value is accessed by a different world than the worl d that created the value. | 45 // Return null when the value is accessed by a different world than the worl d that created the value. |
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 void PromiseRejectionEvent::setWrapperReference(v8::Isolate* isolate, const v8:: Persistent<v8::Object>& wrapper) | |
52 { | |
53 if (!m_promise.isEmpty()) | |
54 m_promise.setReference(wrapper, isolate); | |
haraken
2015/06/29 07:26:53
This reference can be a cross-world reference. Wou
| |
55 if (!m_reason.isEmpty()) | |
56 m_reason.setReference(wrapper, isolate); | |
57 } | |
58 | |
51 const AtomicString& PromiseRejectionEvent::interfaceName() const | 59 const AtomicString& PromiseRejectionEvent::interfaceName() const |
52 { | 60 { |
53 return EventNames::PromiseRejectionEvent; | 61 return EventNames::PromiseRejectionEvent; |
54 } | 62 } |
55 | 63 |
56 DEFINE_TRACE(PromiseRejectionEvent) | 64 DEFINE_TRACE(PromiseRejectionEvent) |
57 { | 65 { |
58 Event::trace(visitor); | 66 Event::trace(visitor); |
59 } | 67 } |
60 | 68 |
61 void PromiseRejectionEvent::didCollectPromise(const v8::WeakCallbackInfo<Promise RejectionEvent>& data) | 69 void PromiseRejectionEvent::didCollectPromise(const v8::WeakCallbackInfo<Promise RejectionEvent>& data) |
62 { | 70 { |
63 data.GetParameter()->m_promise.clear(); | 71 data.GetParameter()->m_promise.clear(); |
64 } | 72 } |
65 | 73 |
66 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR ejectionEvent>& data) | 74 void PromiseRejectionEvent::didCollectReason(const v8::WeakCallbackInfo<PromiseR ejectionEvent>& data) |
67 { | 75 { |
68 data.GetParameter()->m_reason.clear(); | 76 data.GetParameter()->m_reason.clear(); |
69 } | 77 } |
70 | 78 |
71 } // namespace blink | 79 } // namespace blink |
OLD | NEW |