Changeset 182349 in webkit
- Timestamp:
- Apr 4, 2015 5:51:53 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r182346 r182349 1 2015-04-04 Simon Fraser <simon.fraser@apple.com> 2 3 Crash under Document::absoluteRegionForEventTargets on build.webkit.org/dashboard 4 https://bugs.webkit.org/show_bug.cgi?id=143406 5 rdar://problem/20407080 6 7 Reviewed by Ryosuke Niwa. 8 9 Test configurations of elements with different parenting and event handlers adding orders, and multiple handlers on 10 the same node. 11 12 * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash-expected.txt: Added. 13 * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html: Added. 14 * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash-expected.txt: Added. 15 * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html: Added. 16 * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash-expected.txt: Added. 17 * platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html: Added. 18 1 19 2015-04-04 Simon Fraser <simon.fraser@apple.com> 2 20 -
trunk/Source/WebCore/ChangeLog
r182346 r182349 1 2015-04-04 Simon Fraser <simon.fraser@apple.com> 2 3 Crash under Document::absoluteRegionForEventTargets on build.webkit.org/dashboard 4 https://bugs.webkit.org/show_bug.cgi?id=143406 5 rdar://problem/20407080 6 7 Reviewed by Ryosuke Niwa. 8 9 We failed to remove elements from Document's m_wheelEventTargets HashSet when the 10 elements were destroyed with wheel handlers still on them. Fix by removing the 11 node from the set via Node::willBeDeletedFrom(). 12 13 Tests: platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html 14 platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html 15 platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html 16 17 * dom/Document.cpp: 18 (WebCore::removeHandlerFromSet): Helper to remove one or all handlers on the given node. 19 (WebCore::Document::didRemoveWheelEventHandler): Add a parameter to specify whether we're 20 removing all handlers on the given node. 21 (WebCore::Document::didRemoveTouchEventHandler): Use removeHandlerFromSet(). 22 * dom/Document.h: 23 * dom/Node.cpp: 24 (WebCore::Node::willBeDeletedFrom): Tell the document we're removing all handlers 25 for this node. 26 1 27 2015-04-04 Simon Fraser <simon.fraser@apple.com> 2 28 -
trunk/Source/WebCore/dom/Document.cpp
r182271 r182349 6004 6004 } 6005 6005 6006 void Document::didRemoveWheelEventHandler(Node& node) 6006 static bool removeHandlerFromSet(EventTargetSet& handlerSet, Node& node, EventHandlerRemoval removal) 6007 { 6008 switch (removal) { 6009 case EventHandlerRemoval::One: 6010 return handlerSet.remove(&node); 6011 case EventHandlerRemoval::All: 6012 return handlerSet.removeAll(&node); 6013 } 6014 return false; 6015 } 6016 6017 void Document::didRemoveWheelEventHandler(Node& node, EventHandlerRemoval removal) 6007 6018 { 6008 6019 if (!m_wheelEventTargets) 6009 6020 return; 6010 6021 6011 ASSERT(m_wheelEventTargets->contains(&node));6012 m_wheelEventTargets->remove(&node);6022 if (!removeHandlerFromSet(*m_wheelEventTargets, node, removal)) 6023 return; 6013 6024 6014 6025 if (Document* parent = parentDocument()) { … … 6057 6068 } 6058 6069 6059 void Document::didRemoveTouchEventHandler(Node& handler )6070 void Document::didRemoveTouchEventHandler(Node& handler, EventHandlerRemoval removal) 6060 6071 { 6061 6072 #if ENABLE(TOUCH_EVENTS) … … 6063 6074 return; 6064 6075 6065 ASSERT(m_touchEventTargets->contains(&handler)); 6066 m_touchEventTargets->remove(&handler); 6076 removeHandlerFromSet(*m_touchEventTargets, handler, removal)) 6067 6077 6068 6078 if (Document* parent = parentDocument()) { … … 6085 6095 #else 6086 6096 UNUSED_PARAM(handler); 6097 UNUSED_PARAM(removal); 6087 6098 #endif 6088 6099 } … … 6140 6151 for (auto it : *targets) { 6141 6152 LayoutRect rootRelativeBounds; 6142 6153 6143 6154 if (is<Document>(it.key)) { 6144 6155 Document* document = downcast<Document>(it.key); -
trunk/Source/WebCore/dom/Document.h
r182242 r182349 241 241 const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1; 242 242 243 enum class EventHandlerRemoval { One, All }; 243 244 typedef HashCountedSet<Node*> EventTargetSet; 244 245 … … 1124 1125 1125 1126 void didAddWheelEventHandler(Node&); 1126 void didRemoveWheelEventHandler(Node& );1127 void didRemoveWheelEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One); 1127 1128 1128 1129 double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; } … … 1140 1141 1141 1142 void didAddTouchEventHandler(Node&); 1142 void didRemoveTouchEventHandler(Node& );1143 void didRemoveTouchEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One); 1143 1144 1144 1145 void didRemoveEventTargetNode(Node&); -
trunk/Source/WebCore/dom/Node.cpp
r181514 r182349 329 329 { 330 330 if (hasEventTargetData()) { 331 document.didRemoveWheelEventHandler(*this, EventHandlerRemoval::All); 331 332 #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS) 332 333 document.removeTouchEventListener(this, true); 334 #else 335 // FIXME: This should call didRemoveTouchEventHandler(). 333 336 #endif 334 337 clearEventTargetData();
Note: See TracChangeset
for help on using the changeset viewer.