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

Side by Side Diff: Source/core/events/Event.h

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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 17 matching lines...) Expand all
28 #include "core/CoreExport.h" 28 #include "core/CoreExport.h"
29 #include "core/dom/DOMTimeStamp.h" 29 #include "core/dom/DOMTimeStamp.h"
30 #include "core/events/EventInit.h" 30 #include "core/events/EventInit.h"
31 #include "core/events/EventPath.h" 31 #include "core/events/EventPath.h"
32 #include "platform/heap/Handle.h" 32 #include "platform/heap/Handle.h"
33 #include "wtf/RefCounted.h" 33 #include "wtf/RefCounted.h"
34 #include "wtf/text/AtomicString.h" 34 #include "wtf/text/AtomicString.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 class DOMWrapperWorld;
38 class EventTarget; 39 class EventTarget;
39 class ExecutionContext; 40 class ExecutionContext;
40 41
41 class CORE_EXPORT Event : public RefCountedWillBeGarbageCollectedFinalized<Event >, public ScriptWrappable { 42 class CORE_EXPORT Event : public RefCountedWillBeGarbageCollectedFinalized<Event >, public ScriptWrappable {
42 DEFINE_WRAPPERTYPEINFO(); 43 DEFINE_WRAPPERTYPEINFO();
43 public: 44 public:
44 enum PhaseType { 45 enum PhaseType {
45 NONE = 0, 46 NONE = 0,
46 CAPTURING_PHASE = 1, 47 CAPTURING_PHASE = 1,
47 AT_TARGET = 2, 48 AT_TARGET = 2,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; } 179 EventPath& eventPath() { ASSERT(m_eventPath); return *m_eventPath; }
179 void initEventPath(Node&); 180 void initEventPath(Node&);
180 181
181 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const; 182 WillBeHeapVector<RefPtrWillBeMember<EventTarget>> path(ScriptState*) const;
182 183
183 bool isBeingDispatched() const { return eventPhase(); } 184 bool isBeingDispatched() const { return eventPhase(); }
184 185
185 double uiCreateTime() const { return m_uiCreateTime; } 186 double uiCreateTime() const { return m_uiCreateTime; }
186 void setUICreateTime(double uiCreateTime) { m_uiCreateTime = uiCreateTime; } 187 void setUICreateTime(double uiCreateTime) { m_uiCreateTime = uiCreateTime; }
187 188
189 // Events that must not leak across isolated world, similar to how
190 // ErrorEvent behaves, can override this method.
191 virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return t rue; }
192
188 DECLARE_VIRTUAL_TRACE(); 193 DECLARE_VIRTUAL_TRACE();
189 194
190 protected: 195 protected:
191 Event(); 196 Event();
192 Event(const AtomicString& type, bool canBubble, bool cancelable); 197 Event(const AtomicString& type, bool canBubble, bool cancelable);
193 Event(const AtomicString& type, const EventInit&); 198 Event(const AtomicString& type, const EventInit&);
194 199
195 virtual void receivedTarget(); 200 virtual void receivedTarget();
196 bool dispatched() const { return m_target; } 201 bool dispatched() const { return m_target; }
197 202
(...skipping 18 matching lines...) Expand all
216 OwnPtrWillBeMember<EventPath> m_eventPath; 221 OwnPtrWillBeMember<EventPath> m_eventPath;
217 double m_uiCreateTime; // For input events, the time the event was recorded by the UI. 222 double m_uiCreateTime; // For input events, the time the event was recorded by the UI.
218 }; 223 };
219 224
220 #define DEFINE_EVENT_TYPE_CASTS(typeName) \ 225 #define DEFINE_EVENT_TYPE_CASTS(typeName) \
221 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t ypeName()) 226 DEFINE_TYPE_CASTS(typeName, Event, event, event->is##typeName(), event.is##t ypeName())
222 227
223 } // namespace blink 228 } // namespace blink
224 229
225 #endif // Event_h 230 #endif // Event_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8AbstractEventListener.cpp ('k') | Source/core/events/PromiseRejectionEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698