Changeset 260556 in webkit


Ignore:
Timestamp:
Apr 22, 2020 9:56:44 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, reverting r260535.
https://bugs.webkit.org/show_bug.cgi?id=210897

Causes crashes in WK1 (Requested by smfr on #webkit).

Reverted changeset:

"[ Mac wk2 ] imported/w3c/web-platform-tests/notifications
/event-onclose.html is flaky failing."
https://bugs.webkit.org/show_bug.cgi?id=209483
https://trac.webkit.org/changeset/260535

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r260555 r260556  
     12020-04-22  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r260535.
     4        https://bugs.webkit.org/show_bug.cgi?id=210897
     5
     6        Causes crashes in WK1 (Requested by smfr on #webkit).
     7
     8        Reverted changeset:
     9
     10        "[ Mac wk2 ] imported/w3c/web-platform-tests/notifications
     11        /event-onclose.html is flaky failing."
     12        https://bugs.webkit.org/show_bug.cgi?id=209483
     13        https://trac.webkit.org/changeset/260535
     14
    1152020-04-22  Diego Pino Garcia  <dpino@igalia.com>
    216
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r260535 r260556  
    10291029webkit.org/b/209295 [ Debug ] imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html  [ Pass Failure ]
    10301030
     1031webkit.org/b/209483 imported/w3c/web-platform-tests/notifications/event-onclose.html [ Pass Failure ]
     1032
    10311033webkit.org/b/209503 [ Debug ] http/tests/referrer-policy-anchor/origin/cross-origin-http.https.html [ Pass Crash ]
    10321034
  • trunk/Source/WebCore/ChangeLog

    r260554 r260556  
     12020-04-22  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r260535.
     4        https://bugs.webkit.org/show_bug.cgi?id=210897
     5
     6        Causes crashes in WK1 (Requested by smfr on #webkit).
     7
     8        Reverted changeset:
     9
     10        "[ Mac wk2 ] imported/w3c/web-platform-tests/notifications
     11        /event-onclose.html is flaky failing."
     12        https://bugs.webkit.org/show_bug.cgi?id=209483
     13        https://trac.webkit.org/changeset/260535
     14
    1152020-04-22  Darin Adler  <darin@apple.com>
    216
  • trunk/Source/WebCore/Modules/notifications/Notification.cpp

    r260535 r260556  
    6565    , m_tag(options.tag)
    6666    , m_state(Idle)
     67    , m_showNotificationTimer(&document, *this, &Notification::show)
    6768{
    6869    if (!options.icon.isEmpty()) {
     
    7273    }
    7374
    74     queueTaskKeepingObjectAlive(*this, TaskSource::UserInteraction, [this] {
    75         show();
    76     });
     75    m_showNotificationTimer.startOneShot(0_s);
     76    m_showNotificationTimer.suspendIfNeeded();
    7777}
    7878
     
    9595        return;
    9696    }
    97     if (client.show(this))
     97    if (client.show(this)) {
    9898        m_state = Showing;
     99        setPendingActivity(*this);
     100    }
    99101}
    100102
     
    142144        return;
    143145    m_state = Closed;
     146    unsetPendingActivity(*this);
     147}
     148
     149void Notification::queueTask(Function<void()>&& task)
     150{
     151    auto* document = this->document();
     152    if (!document)
     153        return;
     154
     155    document->eventLoop().queueTask(TaskSource::UserInteraction, WTFMove(task));
    144156}
    145157
    146158void Notification::dispatchShowEvent()
    147159{
    148     queueTaskToDispatchEvent(*this, TaskSource::UserInteraction, Event::create(eventNames().showEvent, Event::CanBubble::No, Event::IsCancelable::No));
     160    queueTask([this, pendingActivity = makePendingActivity(*this)] {
     161        dispatchEvent(Event::create(eventNames().showEvent, Event::CanBubble::No, Event::IsCancelable::No));
     162    });
    149163}
    150164
    151165void Notification::dispatchClickEvent()
    152166{
    153     queueTaskKeepingObjectAlive(*this, TaskSource::UserInteraction, [this] {
     167    queueTask([this, pendingActivity = makePendingActivity(*this)] {
    154168        WindowFocusAllowedIndicator windowFocusAllowed;
    155169        dispatchEvent(Event::create(eventNames().clickEvent, Event::CanBubble::No, Event::IsCancelable::No));
     
    159173void Notification::dispatchCloseEvent()
    160174{
    161     queueTaskToDispatchEvent(*this, TaskSource::UserInteraction, Event::create(eventNames().closeEvent, Event::CanBubble::No, Event::IsCancelable::No));
     175    queueTask([this, pendingActivity = makePendingActivity(*this)] {
     176        dispatchEvent(Event::create(eventNames().closeEvent, Event::CanBubble::No, Event::IsCancelable::No));
     177    });
    162178    finalize();
    163179}
     
    165181void Notification::dispatchErrorEvent()
    166182{
    167     queueTaskToDispatchEvent(*this, TaskSource::UserInteraction, Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::No));
     183    queueTask([this, pendingActivity = makePendingActivity(*this)] {
     184        dispatchEvent(Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::No));
     185    });
    168186}
    169187
     
    198216}
    199217
    200 void Notification::eventListenersDidChange()
    201 {
    202     m_hasRelevantEventListener = hasEventListeners(eventNames().clickEvent)
    203         || hasEventListeners(eventNames().closeEvent)
    204         || hasEventListeners(eventNames().errorEvent)
    205         || hasEventListeners(eventNames().showEvent);
    206 }
    207 
    208 // A Notification object must not be garbage collected while the list of notifications contains its corresponding
    209 // notification and it has an event listener whose type is click, show, close, or error.
    210 // See https://notifications.spec.whatwg.org/#garbage-collection
    211 bool Notification::virtualHasPendingActivity() const
    212 {
    213     return m_state == Showing && m_hasRelevantEventListener;
    214 }
    215 
    216218} // namespace WebCore
    217219
  • trunk/Source/WebCore/Modules/notifications/Notification.h

    r260535 r260556  
    3838#include "NotificationDirection.h"
    3939#include "NotificationPermission.h"
     40#include "SuspendableTimer.h"
    4041#include <wtf/URL.h>
    4142#include "WritingMode.h"
     
    9697    EventTargetInterface eventTargetInterface() const final { return NotificationEventTargetInterfaceType; }
    9798
     99    void queueTask(Function<void()>&&);
     100
    98101    // ActiveDOMObject
    99102    const char* activeDOMObjectName() const final;
    100103    void suspend(ReasonForSuspension);
    101104    void stop() final;
    102     bool virtualHasPendingActivity() const final;
    103105
    104     // EventTarget
    105106    void refEventTarget() final { ref(); }
    106107    void derefEventTarget() final { deref(); }
    107     void eventListenersDidChange() final;
    108108
    109109    String m_title;
     
    116116    enum State { Idle, Showing, Closed };
    117117    State m_state { Idle };
    118     bool m_hasRelevantEventListener { false };
     118
     119    SuspendableTimer m_showNotificationTimer;
    119120};
    120121
Note: See TracChangeset for help on using the changeset viewer.