Changeset 269797 in webkit
- Timestamp:
- Nov 13, 2020, 2:17:17 PM (6 years ago)
- Location:
- branches/safari-610-branch/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
dom/GenericEventQueue.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-610-branch/Source/WebCore/ChangeLog
r269796 r269797 1 2020-11-13 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r269321. rdar://problem/71083861 4 5 Protect against HTMLMediaElement being destroyed during disptachEvent(). 6 https://bugs.webkit.org/show_bug.cgi?id=218398 7 <rdar://problem/67613836> 8 9 Reviewed by Chris Dumez. 10 11 Make the MainThreadGenericEventQueue protect the target as well as the owner of the queue. 12 13 Drive-by fix: Create the scoped `eventFiringScope` object after the `protect` object, to ensure 14 that the member variable set by the first scope will safely occur. 15 16 Drive-by fix #2: Also null-check the result of document().page() within HTMLMediaElement::dispatchEvent(). 17 18 * dom/GenericEventQueue.cpp: 19 (WebCore::MainThreadGenericEventQueue::dispatchOneEvent): 20 * html/HTMLMediaElement.cpp: 21 (WebCore::HTMLMediaElement::dispatchEvent): 22 23 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269321 268f45cc-cd09-0410-ab3c-d52691b4dbfc 24 25 2020-11-03 Jer Noble <jer.noble@apple.com> 26 27 Protect against HTMLMediaElement being destroyed during disptachEvent(). 28 https://bugs.webkit.org/show_bug.cgi?id=218398 29 <rdar://problem/67613836> 30 31 Reviewed by Chris Dumez. 32 33 Make the MainThreadGenericEventQueue protect the target as well as the owner of the queue. 34 35 Drive-by fix: Create the scoped `eventFiringScope` object after the `protect` object, to ensure 36 that the member variable set by the first scope will safely occur. 37 38 Drive-by fix #2: Also null-check the result of document().page() within HTMLMediaElement::dispatchEvent(). 39 40 * dom/GenericEventQueue.cpp: 41 (WebCore::MainThreadGenericEventQueue::dispatchOneEvent): 42 * html/HTMLMediaElement.cpp: 43 (WebCore::HTMLMediaElement::dispatchEvent): 44 1 45 2020-11-13 Russell Epstein <repstein@apple.com> 2 46 -
branches/safari-610-branch/Source/WebCore/dom/GenericEventQueue.cpp
r259299 r269797 65 65 ASSERT(!m_pendingEvents.isEmpty()); 66 66 67 Ref<EventTarget> protect(m_owner); 67 68 SetForScope<bool> eventFiringScope(m_isFiringEvent, true); 68 Ref<EventTarget> protect(m_owner);69 69 70 70 RefPtr<Event> event = m_pendingEvents.takeFirst(); 71 EventTarget&target = event->target() ? *event->target() : m_owner;72 ASSERT_WITH_MESSAGE(!target .scriptExecutionContext()->activeDOMObjectsAreStopped(),71 Ref<EventTarget> target = event->target() ? *event->target() : m_owner; 72 ASSERT_WITH_MESSAGE(!target->scriptExecutionContext()->activeDOMObjectsAreStopped(), 73 73 "An attempt to dispatch an event on a stopped target by EventTargetInterface=%d (nodeName=%s target=%p owner=%p)", 74 m_owner.eventTargetInterface(), m_owner.isNode() ? static_cast<Node&>(m_owner).nodeName().ascii().data() : "", &target, &m_owner);75 target .dispatchEvent(*event);74 m_owner.eventTargetInterface(), m_owner.isNode() ? static_cast<Node&>(m_owner).nodeName().ascii().data() : "", target.ptr(), &m_owner); 75 target->dispatchEvent(*event); 76 76 } 77 77
Note:
See TracChangeset
for help on using the changeset viewer.