Changeset 236446 in webkit
- Timestamp:
- Sep 24, 2018 5:28:42 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236445 r236446 1 2018-09-24 Ryosuke Niwa <rniwa@webkit.org> 2 3 Don't cause a crash even when some IDL attribute is missing CEReactions 4 https://bugs.webkit.org/show_bug.cgi?id=189937 5 6 Reviewed by Simon Fraser. 7 8 Replaced release assertions in ElementQueue::add and ElementQueue::invokeAll by debug assertions 9 since a missing CEReactions resulting in a crash is a terrible user experience. 10 11 Also made the iteration in invokeAll safe when more elements were added to m_elements. 12 13 No new tests since we would still hit debug assertions, and this behavior should only come up 14 when some IDL attribute is erroneously missing CEReactions. 15 16 * dom/CustomElementReactionQueue.cpp: 17 (WebCore::CustomElementReactionQueue::ElementQueue::add): 18 (WebCore::CustomElementReactionQueue::ElementQueue::invokeAll): 19 1 20 2018-09-24 Wenson Hsieh <wenson_hsieh@apple.com> 2 21 -
trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp
r236376 r236446 226 226 inline void CustomElementReactionQueue::ElementQueue::add(Element& element) 227 227 { 228 RELEASE_ASSERT(!m_invoking);228 ASSERT(!m_invoking); 229 229 // FIXME: Avoid inserting the same element multiple times. 230 230 m_elements.append(element); … … 235 235 RELEASE_ASSERT(!m_invoking); 236 236 SetForScope<bool> invoking(m_invoking, true); 237 auto originalSize = m_elements.size(); 238 for (auto& element : m_elements) { 239 auto* queue = element->reactionQueue(); 237 unsigned originalSize = m_elements.size(); 238 // It's possible for more elements to be enqueued if some IDL attributes were missing CEReactions. 239 // Invoke callbacks slightly later here instead of crashing / ignoring those cases. 240 for (unsigned i = 0; i < m_elements.size(); ++i) { 241 auto& element = m_elements[i].get(); 242 auto* queue = element.reactionQueue(); 240 243 ASSERT(queue); 241 queue->invokeAll(element .get());242 } 243 RELEASE_ASSERT(m_elements.size() == originalSize);244 queue->invokeAll(element); 245 } 246 ASSERT_UNUSED(originalSize, m_elements.size() == originalSize); 244 247 m_elements.clear(); 245 248 }
Note: See TracChangeset
for help on using the changeset viewer.