Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: Source/core/events/PromiseRejectionEvent.cpp

Issue 1218733003: Restrict PromiseRejectionEvents to their originating world (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/events/PromiseRejectionEvent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/core/events/PromiseRejectionEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698