Changeset 171261 in webkit


Ignore:
Timestamp:
Jul 19, 2014 3:08:55 AM (10 years ago)
Author:
zandobersek@gmail.com
Message:

Document::unregisterNodeListforInvalidation() and Document::unregisterCollection() have incorrect assertions
https://bugs.webkit.org/show_bug.cgi?id=134869

Reviewed by Darin Adler.

Both methods should assert that the relevant HashMap is either empty if invalidation originates
from Document::invalidateNodeListAndCollectionCaches() or acutally contains the element that is
being invalidated. In the first case the HashMap is empty because its entries were moved out in
the Document::invalidateNodeListAndCollectionCaches().

This was exposed by r170995 (later rolled out in r170999) which introduced move constructor and
move assignment operators for HashTable. The assertions in the titular methods won't be passing
until r170995 relands.

  • dom/Document.cpp:

(WebCore::Document::unregisterNodeListForInvalidation):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r171259 r171261  
     12014-07-19  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        Document::unregisterNodeListforInvalidation() and Document::unregisterCollection() have incorrect assertions
     4        https://bugs.webkit.org/show_bug.cgi?id=134869
     5
     6        Reviewed by Darin Adler.
     7
     8        Both methods should assert that the relevant HashMap is either empty if invalidation originates
     9        from Document::invalidateNodeListAndCollectionCaches() or acutally contains the element that is
     10        being invalidated. In the first case the HashMap is empty because its entries were moved out in
     11        the Document::invalidateNodeListAndCollectionCaches().
     12
     13        This was exposed by r170995 (later rolled out in r170999) which introduced move constructor and
     14        move assignment operators for HashTable. The assertions in the titular methods won't be passing
     15        until r170995 relands.
     16
     17        * dom/Document.cpp:
     18        (WebCore::Document::unregisterNodeListForInvalidation):
     19
    1202014-07-18  Eric Carlson  <eric.carlson@apple.com>
    221
  • trunk/Source/WebCore/dom/Document.cpp

    r170774 r171261  
    34923492    if (!list.isRegisteredForInvalidationAtDocument())
    34933493        return;
    3494     if (!m_listsInvalidatedAtDocument.size()) {
    3495         ASSERT(m_inInvalidateNodeListAndCollectionCaches);
    3496         return;
    3497     }
    3498     ASSERT(m_listsInvalidatedAtDocument.contains(&list));
     3494
     3495    list.setRegisteredForInvalidationAtDocument(false);
     3496    ASSERT(m_inInvalidateNodeListAndCollectionCaches
     3497        ? m_listsInvalidatedAtDocument.isEmpty()
     3498        : m_listsInvalidatedAtDocument.contains(&list));
    34993499    m_listsInvalidatedAtDocument.remove(&list);
    3500     list.setRegisteredForInvalidationAtDocument(false);
    35013500}
    35023501
     
    35123511    ASSERT(m_nodeListAndCollectionCounts[collection.invalidationType()]);
    35133512    m_nodeListAndCollectionCounts[collection.invalidationType()]--;
    3514     if (collection.isRootedAtDocument()) {
    3515         if (!m_collectionsInvalidatedAtDocument.size()) {
    3516             ASSERT(m_inInvalidateNodeListAndCollectionCaches);
    3517             return;
    3518         }
    3519         ASSERT(m_collectionsInvalidatedAtDocument.contains(&collection));
    3520         m_collectionsInvalidatedAtDocument.remove(&collection);
    3521     }
     3513    if (!collection.isRootedAtDocument())
     3514        return;
     3515
     3516    ASSERT(m_inInvalidateNodeListAndCollectionCaches
     3517        ? m_collectionsInvalidatedAtDocument.isEmpty()
     3518        : m_collectionsInvalidatedAtDocument.contains(&collection));
     3519    m_collectionsInvalidatedAtDocument.remove(&collection);
    35223520}
    35233521
Note: See TracChangeset for help on using the changeset viewer.