Changeset 236440 in webkit


Ignore:
Timestamp:
Sep 24, 2018 4:11:36 PM (6 years ago)
Author:
rniwa@webkit.org
Message:

imported/w3c/web-platform-tests/shadow-dom/slotchange.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=167652

Reviewed by Saam Barati.

Source/WebCore:

The bug appears to be caused by the JS wrappers of slot elements getting prematurely collected.
Deployed GCReachableRef introduced in r236376 to fix the bug.

Test: fast/shadow-dom/signal-slot-list-retains-js-wrappers.html

  • dom/MutationObserver.cpp:

(WebCore::signalSlotList):
(WebCore::MutationObserver::enqueueSlotChangeEvent):
(WebCore::MutationObserver::notifyMutationObservers):

LayoutTests:

Added a regression test for signaling a lot of slot elements.

  • fast/shadow-dom/signal-slot-list-retains-js-wrappers-expected.txt: Added.
  • fast/shadow-dom/signal-slot-list-retains-js-wrappers.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r236439 r236440  
     12018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        imported/w3c/web-platform-tests/shadow-dom/slotchange.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=167652
     5
     6        Reviewed by Saam Barati.
     7
     8        Added a regression test for signaling a lot of slot elements.
     9
     10        * fast/shadow-dom/signal-slot-list-retains-js-wrappers-expected.txt: Added.
     11        * fast/shadow-dom/signal-slot-list-retains-js-wrappers.html: Added.
     12
    1132018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r236439 r236440  
     12018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        imported/w3c/web-platform-tests/shadow-dom/slotchange.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=167652
     5
     6        Reviewed by Saam Barati.
     7
     8        The bug appears to be caused by the JS wrappers of slot elements getting prematurely collected.
     9        Deployed GCReachableRef introduced in r236376 to fix the bug.
     10
     11        Test: fast/shadow-dom/signal-slot-list-retains-js-wrappers.html
     12
     13        * dom/MutationObserver.cpp:
     14        (WebCore::signalSlotList):
     15        (WebCore::MutationObserver::enqueueSlotChangeEvent):
     16        (WebCore::MutationObserver::notifyMutationObservers):
     17
    1182018-09-24  Ryosuke Niwa  <rniwa@webkit.org>
    219
  • trunk/Source/WebCore/dom/MutationObserver.cpp

    r230695 r236440  
    3535
    3636#include "Document.h"
     37#include "GCReachableRef.h"
    3738#include "HTMLSlotElement.h"
    3839#include "Microtasks.h"
     
    152153
    153154// https://dom.spec.whatwg.org/#signal-slot-list
    154 static Vector<RefPtr<HTMLSlotElement>>& signalSlotList()
    155 {
    156     static NeverDestroyed<Vector<RefPtr<HTMLSlotElement>>> list;
     155static Vector<GCReachableRef<HTMLSlotElement>>& signalSlotList()
     156{
     157    static NeverDestroyed<Vector<GCReachableRef<HTMLSlotElement>>> list;
    157158    return list;
    158159}
     
    190191{
    191192    ASSERT(isMainThread());
    192     ASSERT(!signalSlotList().contains(&slot));
    193     signalSlotList().append(&slot);
     193    ASSERT(signalSlotList().findMatching([&slot](auto& entry) { return entry.ptr() == &slot; }) == notFound);
     194    signalSlotList().append(slot);
    194195
    195196    queueMutationObserverCompoundMicrotask();
     
    274275        // 3. Let signalList be a copy of unit of related similar-origin browsing contexts' signal slot list.
    275276        // 4. Empty unit of related similar-origin browsing contexts' signal slot list.
    276         Vector<RefPtr<HTMLSlotElement>> slotList;
     277        Vector<GCReachableRef<HTMLSlotElement>> slotList;
    277278        if (!signalSlotList().isEmpty()) {
    278279            slotList.swap(signalSlotList());
Note: See TracChangeset for help on using the changeset viewer.