Changeset 260556 in webkit
- Timestamp:
- Apr 22, 2020 9:56:44 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r260555 r260556 1 2020-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 1 15 2020-04-22 Diego Pino Garcia <dpino@igalia.com> 2 16 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r260535 r260556 1029 1029 webkit.org/b/209295 [ Debug ] imported/w3c/web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html [ Pass Failure ] 1030 1030 1031 webkit.org/b/209483 imported/w3c/web-platform-tests/notifications/event-onclose.html [ Pass Failure ] 1032 1031 1033 webkit.org/b/209503 [ Debug ] http/tests/referrer-policy-anchor/origin/cross-origin-http.https.html [ Pass Crash ] 1032 1034 -
trunk/Source/WebCore/ChangeLog
r260554 r260556 1 2020-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 1 15 2020-04-22 Darin Adler <darin@apple.com> 2 16 -
trunk/Source/WebCore/Modules/notifications/Notification.cpp
r260535 r260556 65 65 , m_tag(options.tag) 66 66 , m_state(Idle) 67 , m_showNotificationTimer(&document, *this, &Notification::show) 67 68 { 68 69 if (!options.icon.isEmpty()) { … … 72 73 } 73 74 74 queueTaskKeepingObjectAlive(*this, TaskSource::UserInteraction, [this] { 75 show(); 76 }); 75 m_showNotificationTimer.startOneShot(0_s); 76 m_showNotificationTimer.suspendIfNeeded(); 77 77 } 78 78 … … 95 95 return; 96 96 } 97 if (client.show(this)) 97 if (client.show(this)) { 98 98 m_state = Showing; 99 setPendingActivity(*this); 100 } 99 101 } 100 102 … … 142 144 return; 143 145 m_state = Closed; 146 unsetPendingActivity(*this); 147 } 148 149 void 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)); 144 156 } 145 157 146 158 void Notification::dispatchShowEvent() 147 159 { 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 }); 149 163 } 150 164 151 165 void Notification::dispatchClickEvent() 152 166 { 153 queueTask KeepingObjectAlive(*this, TaskSource::UserInteraction, [this] {167 queueTask([this, pendingActivity = makePendingActivity(*this)] { 154 168 WindowFocusAllowedIndicator windowFocusAllowed; 155 169 dispatchEvent(Event::create(eventNames().clickEvent, Event::CanBubble::No, Event::IsCancelable::No)); … … 159 173 void Notification::dispatchCloseEvent() 160 174 { 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 }); 162 178 finalize(); 163 179 } … … 165 181 void Notification::dispatchErrorEvent() 166 182 { 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 }); 168 186 } 169 187 … … 198 216 } 199 217 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 corresponding209 // notification and it has an event listener whose type is click, show, close, or error.210 // See https://notifications.spec.whatwg.org/#garbage-collection211 bool Notification::virtualHasPendingActivity() const212 {213 return m_state == Showing && m_hasRelevantEventListener;214 }215 216 218 } // namespace WebCore 217 219 -
trunk/Source/WebCore/Modules/notifications/Notification.h
r260535 r260556 38 38 #include "NotificationDirection.h" 39 39 #include "NotificationPermission.h" 40 #include "SuspendableTimer.h" 40 41 #include <wtf/URL.h> 41 42 #include "WritingMode.h" … … 96 97 EventTargetInterface eventTargetInterface() const final { return NotificationEventTargetInterfaceType; } 97 98 99 void queueTask(Function<void()>&&); 100 98 101 // ActiveDOMObject 99 102 const char* activeDOMObjectName() const final; 100 103 void suspend(ReasonForSuspension); 101 104 void stop() final; 102 bool virtualHasPendingActivity() const final;103 105 104 // EventTarget105 106 void refEventTarget() final { ref(); } 106 107 void derefEventTarget() final { deref(); } 107 void eventListenersDidChange() final;108 108 109 109 String m_title; … … 116 116 enum State { Idle, Showing, Closed }; 117 117 State m_state { Idle }; 118 bool m_hasRelevantEventListener { false }; 118 119 SuspendableTimer m_showNotificationTimer; 119 120 }; 120 121
Note: See TracChangeset
for help on using the changeset viewer.