Changeset 139345 in webkit


Ignore:
Timestamp:
Jan 10, 2013, 11:29:37 AM (12 years ago)
Author:
leviw@chromium.org
Message:

Regression(r137939): Heap-use-after-free in WebCore::accumulateDocumentEventTargetRects
https://bugs.webkit.org/show_bug.cgi?id=106454

Reviewed by James Robinson.

Source/WebCore:

Correctly removing child Documents from their parent's tracked touch handler maps when detaching and
when their last touch event handler is removed.

Test: fast/events/touch/nested-document-with-touch-handler-detached-crash.html

  • dom/Document.cpp:

(WebCore::Document::detach):
(WebCore::Document::didRemoveEventTargetNode):

LayoutTests:

  • fast/events/touch/nested-document-with-touch-handler-detached-crash.html: Added.
  • fast/events/touch/nested-document-with-touch-handler-detached-crash-expected.txt: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139344 r139345  
     12013-01-10  Levi Weintraub  <leviw@chromium.org>
     2
     3        Regression(r137939): Heap-use-after-free in WebCore::accumulateDocumentEventTargetRects
     4        https://bugs.webkit.org/show_bug.cgi?id=106454
     5
     6        Reviewed by James Robinson.
     7
     8        * fast/events/touch/nested-document-with-touch-handler-detached-crash.html: Added.
     9        * fast/events/touch/nested-document-with-touch-handler-detached-crash-expected.txt: Added.
     10
    1112013-01-10  Ojan Vafai  <ojan@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r139343 r139345  
     12013-01-10  Levi Weintraub  <leviw@chromium.org>
     2
     3        Regression(r137939): Heap-use-after-free in WebCore::accumulateDocumentEventTargetRects
     4        https://bugs.webkit.org/show_bug.cgi?id=106454
     5
     6        Reviewed by James Robinson.
     7
     8        Correctly removing child Documents from their parent's tracked touch handler maps when detaching and
     9        when their last touch event handler is removed.
     10
     11        Test: fast/events/touch/nested-document-with-touch-handler-detached-crash.html
     12
     13        * dom/Document.cpp:
     14        (WebCore::Document::detach):
     15        (WebCore::Document::didRemoveEventTargetNode):
     16
    1172013-01-10  Nate Chapin  <japhet@chromium.org>
    218
  • trunk/Source/WebCore/dom/Document.cpp

    r139199 r139345  
    21182118        render->destroy();
    21192119
     2120#if ENABLE(TOUCH_EVENTS)
     2121    if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument())
     2122        parentDocument()->didRemoveEventTargetNode(this);
     2123#endif
     2124
    21202125    // This is required, as our Frame might delete itself as soon as it detaches
    21212126    // us. However, this violates Node::detach() semantics, as it's never
     
    56605665void Document::didRemoveEventTargetNode(Node* handler)
    56615666{
    5662     if (m_touchEventTargets.get())
     5667    if (m_touchEventTargets) {
    56635668        m_touchEventTargets->removeAll(handler);
    5664     if (handler == this)
    5665         if (Document* parentDocument = this->parentDocument())
    5666             parentDocument->didRemoveEventTargetNode(this);
     5669        if ((handler == this || m_touchEventTargets->isEmpty()) && parentDocument())
     5670            parentDocument()->didRemoveEventTargetNode(this);
     5671    }
    56675672}
    56685673#endif
Note: See TracChangeset for help on using the changeset viewer.