Changeset 262016 in webkit
- Timestamp:
- May 21, 2020 11:03:36 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r262015 r262016 1 2020-05-21 Chris Dumez <cdumez@apple.com> 2 3 ASSERTION FAILED: m_wrapper on fast/events/scoped/editing-commands.html 4 https://bugs.webkit.org/show_bug.cgi?id=209862 5 <rdar://problem/61164607> 6 7 Reviewed by Darin Adler. 8 9 Make sure ScopedEventQueue keeps its event targets alive using a GCReachableRef<Node> 10 so that it keeps alive both the target and its JS wrapper. 11 12 No new tests, covered by existing test. 13 14 * dom/ScopedEventQueue.cpp: 15 (WebCore::ScopedEventQueue::enqueueEvent): 16 (WebCore::ScopedEventQueue::dispatchEvent const): 17 (WebCore::ScopedEventQueue::dispatchAllEvents): 18 * dom/ScopedEventQueue.h: 19 1 20 2020-05-21 Sihui Liu <sihui_liu@apple.com> 2 21 -
trunk/Source/WebCore/dom/ScopedEventQueue.cpp
r224740 r262016 47 47 { 48 48 ASSERT(is<Node>(event->target())); 49 auto& target = downcast<Node>(*event->target()); 50 ScopedEvent scopedEvent = { WTFMove(event), target }; 49 51 if (m_scopingLevel) 50 m_queuedEvents.append(WTFMove( event));52 m_queuedEvents.append(WTFMove(scopedEvent)); 51 53 else 52 dispatchEvent( event);54 dispatchEvent(scopedEvent); 53 55 } 54 56 55 void ScopedEventQueue::dispatchEvent( Event& event) const57 void ScopedEventQueue::dispatchEvent(const ScopedEvent& event) const 56 58 { 57 downcast<Node>(*event.target()).dispatchEvent(event);59 event.target->dispatchEvent(event.event); 58 60 } 59 61 60 62 void ScopedEventQueue::dispatchAllEvents() 61 63 { 62 Vector<Ref<Event>> queuedEvents = WTFMove(m_queuedEvents);64 auto queuedEvents = std::exchange(m_queuedEvents, { }); 63 65 for (auto& queuedEvent : queuedEvents) 64 66 dispatchEvent(queuedEvent); -
trunk/Source/WebCore/dom/ScopedEventQueue.h
r219595 r262016 31 31 #pragma once 32 32 33 #include "GCReachableRef.h" 33 34 #include <wtf/Forward.h> 34 35 #include <wtf/Noncopyable.h> … … 51 52 ~ScopedEventQueue() = delete; 52 53 53 void dispatchEvent(Event&) const; 54 struct ScopedEvent { 55 Ref<Event> event; 56 GCReachableRef<Node> target; 57 }; 58 59 void dispatchEvent(const ScopedEvent&) const; 54 60 void dispatchAllEvents(); 55 61 void incrementScopingLevel(); 56 62 void decrementScopingLevel(); 57 63 58 Vector< Ref<Event>> m_queuedEvents;64 Vector<ScopedEvent> m_queuedEvents; 59 65 unsigned m_scopingLevel { 0 }; 60 66
Note: See TracChangeset
for help on using the changeset viewer.