Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (252823 => 252824)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-11-23 04:28:46 UTC (rev 252824)
@@ -1,3 +1,15 @@
+2019-11-21 Ryosuke Niwa <[email protected]>
+
+ Use the event loop instead of DocumentEventQueue and WorkerEventQueue
+ https://bugs.webkit.org/show_bug.cgi?id=204447
+ <rdar://problem/57420691>
+
+ Reviewed by Antti Koivisto.
+
+ Updated the expected result. It now fails one step head due to EventLoop getting better integrated with timers.
+
+ * web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt:
+
2019-11-20 Simon Fraser <[email protected]>
getComputedStyle returns "auto" for zIndex property even after it has been set, on non-positioned elements
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt (252823 => 252824)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt 2019-11-23 04:28:46 UTC (rev 252824)
@@ -2,5 +2,5 @@
FAIL requestIdleCallback not scheduled when event loop is busy. assert_false: IdleDeadline.didTimeout MUST be false if requestIdleCallback wasn't scheduled due to a timeout expected false got true
-FAIL requestIdleCallback scheduled with timeout when event loop is busy. assert_true: Should only have been run after timeout expected true got false
+FAIL requestIdleCallback scheduled with timeout when event loop is busy. assert_true: IdleDeadline.timeRemaining MUST be equal to zero if requestIdleCallback was scheduled due to a timeout expected true got false
Modified: trunk/Source/WebCore/ChangeLog (252823 => 252824)
--- trunk/Source/WebCore/ChangeLog 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/ChangeLog 2019-11-23 04:28:46 UTC (rev 252824)
@@ -1,3 +1,79 @@
+2019-11-21 Ryosuke Niwa <[email protected]>
+
+ Use the event loop instead of DocumentEventQueue and WorkerEventQueue
+ https://bugs.webkit.org/show_bug.cgi?id=204447
+ <rdar://problem/57420691>
+
+ Reviewed by Antti Koivisto.
+
+ This patch replaces every use of DocumentEventQueue and WorkerEventQueue by the integration
+ with the event loop.
+
+ Because this changes the order by which some of the affected events fire and tasks run,
+ this patch also makes WindowEventLoop::scheduleToRun use a Timer instead of callOnMainThread
+ in order to avoid introducing new test failures.
+
+ In addition, WebSQL needed a code change to scheudle tasks via the event loop after moving
+ to the event loop as callOnMainThread could run before or after a 0s timer fires depending
+ on whether it was called during another timer or not; meaning that it could change the order
+ of operations with respect to other tasks scheduled via event loops in some cases.
+
+ Finally, added the links to various specifications where appropriate.
+
+ * Modules/indexeddb/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::connectionToServerLost):
+ (WebCore::IDBDatabase::fireVersionChangeEvent):
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::enqueueEvent):
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::enqueueEvent):
+ (WebCore::IDBTransaction::dispatchEvent):
+ * Modules/mediastream/RTCDataChannel.cpp:
+ (WebCore::RTCDataChannel::scheduleDispatchEvent):
+ * Modules/webdatabase/Database.cpp:
+ (WebCore::Database::scheduleTransactionCallback): Schedule a task on the event loop once
+ we're in the main thread as the order of operation could change with respect to other tasks
+ scheduled via the event loop otherwise.
+ * Modules/webdatabase/SQLTransaction.cpp:
+ (WebCore::SQLTransaction::notifyDatabaseThreadIsShuttingDown): Ditto.
+ * dom/Document.cpp:
+ (WebCore::Document::visibilityStateChanged):
+ (WebCore::Document::prepareForDestruction):
+ (WebCore::Document::enqueueWindowEvent): Deleted.
+ (WebCore::Document::queueTaskToDispatchEvent): Added.
+ (WebCore::Document::enqueueDocumentEvent): Deleted.
+ (WebCore::Document::queueTaskToDispatchEventOnWindow): Added.
+ (WebCore::Document::enqueueOverflowEvent):
+ (WebCore::Document::enqueueSecurityPolicyViolationEvent):
+ (WebCore::Document::enqueueHashchangeEvent): Rewritten. Keep the target node alive until
+ the overflow event fires.
+ fired on an overflow element
+ * dom/Document.h:
+ * dom/ScriptExecutionContext.h:
+ * dom/TaskSource.h:
+ * dom/WindowEventLoop.cpp:
+ (WebCore::WindowEventLoop::WindowEventLoop):
+ (WebCore::WindowEventLoop::scheduleToRun):
+ * dom/WindowEventLoop.h:
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::languagesChanged):
+ * page/PointerCaptureController.cpp:
+ (WebCore::PointerCaptureController::elementWasRemoved):
+ * page/PointerLockController.cpp:
+ (WebCore::PointerLockController::enqueueEvent):
+ * storage/StorageEventDispatcher.cpp:
+ (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames):
+ (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames):
+ * workers/WorkerGlobalScope.cpp:
+ (WebCore::WorkerGlobalScope::WorkerGlobalScope):
+ (WebCore::WorkerGlobalScope::eventQueue const): Deleted.
+ * workers/WorkerGlobalScope.h:
+ * worklets/WorkletGlobalScope.cpp:
+ (WebCore::WorkletGlobalScope::WorkletGlobalScope):
+ * worklets/WorkletGlobalScope.h:
+
2019-11-22 Ryosuke Niwa <[email protected]>
REGRESSION (r252792?): 6 inspector/canvas tests crashing
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (252823 => 252824)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -279,13 +279,13 @@
errorEvent->setTarget(this);
if (auto* context = scriptExecutionContext())
- context->eventQueue().enqueueEvent(WTFMove(errorEvent));
+ queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(errorEvent));
auto closeEvent = Event::create(m_eventNames.closeEvent, Event::CanBubble::Yes, Event::IsCancelable::No);
closeEvent->setTarget(this);
if (auto* context = scriptExecutionContext())
- context->eventQueue().enqueueEvent(WTFMove(closeEvent));
+ queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(closeEvent));
}
void IDBDatabase::maybeCloseInServer()
@@ -468,8 +468,7 @@
}
Ref<Event> event = IDBVersionChangeEvent::create(requestIdentifier, currentVersion, requestedVersion, m_eventNames.versionchangeEvent);
- event->setTarget(this);
- scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
+ queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(event));
}
void IDBDatabase::dispatchEvent(Event& event)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (252823 => 252824)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -290,8 +290,7 @@
if (m_contextStopped)
return;
- event->setTarget(this);
- scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
+ queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(event));
}
void IDBRequest::dispatchEvent(Event& event)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (252823 => 252824)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -625,8 +625,7 @@
if (!scriptExecutionContext() || m_contextStopped)
return;
- event->setTarget(this);
- scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
+ queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(event));
}
void IDBTransaction::dispatchEvent(Event& event)
@@ -636,7 +635,6 @@
ASSERT(canCurrentThreadAccessThreadLocalData(m_database->originThread()));
ASSERT(scriptExecutionContext());
ASSERT(!m_contextStopped);
- ASSERT(event.target() == this);
ASSERT(event.type() == eventNames().completeEvent || event.type() == eventNames().abortEvent);
auto protectedThis = makeRef(*this);
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp (252823 => 252824)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -230,8 +230,8 @@
if (m_stopped)
return;
- event->setTarget(this);
- scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
+ // https://w3c.github.io/webrtc-pc/#operation
+ queueTaskToDispatchEvent(*this, TaskSource::Networking, WTFMove(event));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (252823 => 252824)
--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -703,8 +703,10 @@
void Database::scheduleTransactionCallback(SQLTransaction* transaction)
{
- callOnMainThread([transaction = makeRefPtr(transaction)] {
- transaction->performPendingCallback();
+ callOnMainThread([this, protectedThis = makeRef(*this), transaction = makeRefPtr(transaction)] {
+ m_document->eventLoop().queueTask(TaskSource::Networking, [transaction = transaction.copyRef()] {
+ transaction->performPendingCallback();
+ });
});
}
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp (252823 => 252824)
--- trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -128,7 +128,9 @@
void SQLTransaction::notifyDatabaseThreadIsShuttingDown()
{
callOnMainThread([this, protectedThis = makeRef(*this)]() mutable {
- callErrorCallbackDueToInterruption();
+ m_database->document().eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = protectedThis.copyRef()]() mutable {
+ callErrorCallbackDueToInterruption();
+ });
});
m_backend.notifyDatabaseThreadIsShuttingDown();
Modified: trunk/Source/WebCore/dom/Document.cpp (252823 => 252824)
--- trunk/Source/WebCore/dom/Document.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/dom/Document.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -554,7 +554,6 @@
, m_xmlVersion("1.0"_s)
, m_constantPropertyMap(makeUnique<ConstantPropertyMap>(*this))
, m_documentClasses(documentClasses)
- , m_eventQueue(*this)
#if ENABLE(FULLSCREEN_API)
, m_fullscreenManager { makeUniqueRef<FullscreenManager>(*this) }
#endif
@@ -1707,7 +1706,8 @@
void Document::visibilityStateChanged()
{
- enqueueDocumentEvent(Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+ // // https://w3c.github.io/page-visibility/#reacting-to-visibilitychange-changes
+ queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
for (auto* client : m_visibilityStateCallbackClients)
client->visibilityStateChanged();
@@ -2532,7 +2532,6 @@
InspectorInstrumentation::documentDetached(*this);
stopActiveDOMObjects();
- m_eventQueue.close();
#if ENABLE(FULLSCREEN_API)
m_fullscreenManager->emptyEventQueue();
#endif
@@ -4737,21 +4736,32 @@
m_cachedResourceLoader->documentDidFinishLoadEvent();
}
-void Document::enqueueWindowEvent(Ref<Event>&& event)
+void Document::queueTaskToDispatchEvent(TaskSource source, Ref<Event>&& event)
{
- event->setTarget(m_domWindow.get());
- m_eventQueue.enqueueEvent(WTFMove(event));
+ eventLoop().queueTask(source, [document = makeRef(*this), event = WTFMove(event)] {
+ document->dispatchEvent(event);
+ });
}
-void Document::enqueueDocumentEvent(Ref<Event>&& event)
+void Document::queueTaskToDispatchEventOnWindow(TaskSource source, Ref<Event>&& event)
{
- event->setTarget(this);
- m_eventQueue.enqueueEvent(WTFMove(event));
+ eventLoop().queueTask(source, [this, protectedThis = makeRef(*this), event = WTFMove(event)] {
+ if (!m_domWindow)
+ return;
+ m_domWindow->dispatchEvent(event);
+ });
}
void Document::enqueueOverflowEvent(Ref<Event>&& event)
{
- m_eventQueue.enqueueEvent(WTFMove(event));
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/overflow_event
+ // FIXME: This event is totally unspecified.
+ auto* target = event->target();
+ RELEASE_ASSERT(target);
+ RELEASE_ASSERT(is<Node>(target));
+ eventLoop().queueTask(TaskSource::DOMManipulation, [protectedTarget = GCReachableRef<Node>(downcast<Node>(*target)), event = WTFMove(event)] {
+ protectedTarget->dispatchEvent(event);
+ });
}
ExceptionOr<Ref<Event>> Document::createEvent(const String& type)
@@ -6372,12 +6382,13 @@
void Document::enqueueSecurityPolicyViolationEvent(SecurityPolicyViolationEvent::Init&& eventInit)
{
- enqueueDocumentEvent(SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, WTFMove(eventInit), Event::IsTrusted::Yes));
+ queueTaskToDispatchEvent(TaskSource::DOMManipulation, SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, WTFMove(eventInit), Event::IsTrusted::Yes));
}
void Document::enqueueHashchangeEvent(const String& oldURL, const String& newURL)
{
- enqueueWindowEvent(HashChangeEvent::create(oldURL, newURL));
+ // FIXME: popstate event and hashchange event are supposed to fire in a single task.
+ queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, HashChangeEvent::create(oldURL, newURL));
}
void Document::dispatchPopstateEvent(RefPtr<SerializedScriptValue>&& stateObject)
Modified: trunk/Source/WebCore/dom/Document.h (252823 => 252824)
--- trunk/Source/WebCore/dom/Document.h 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/dom/Document.h 2019-11-23 04:28:46 UTC (rev 252824)
@@ -1168,14 +1168,13 @@
bool isSecureContext() const final;
bool isJSExecutionForbidden() const final { return false; }
- void enqueueWindowEvent(Ref<Event>&&);
- void enqueueDocumentEvent(Ref<Event>&&);
+ void queueTaskToDispatchEvent(TaskSource, Ref<Event>&&);
+ void queueTaskToDispatchEventOnWindow(TaskSource, Ref<Event>&&);
void enqueueOverflowEvent(Ref<Event>&&);
void dispatchPageshowEvent(PageshowEventPersistence);
WEBCORE_EXPORT void enqueueSecurityPolicyViolationEvent(SecurityPolicyViolationEvent::Init&&);
void enqueueHashchangeEvent(const String& oldURL, const String& newURL);
void dispatchPopstateEvent(RefPtr<SerializedScriptValue>&& stateObject);
- DocumentEventQueue& eventQueue() const final { return m_eventQueue; }
WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener&);
WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener&);
@@ -1825,7 +1824,6 @@
DocumentClassFlags m_documentClasses;
RenderPtr<RenderView> m_renderView;
- mutable DocumentEventQueue m_eventQueue;
HashSet<MediaCanStartListener*> m_mediaCanStartListeners;
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (252823 => 252824)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.h 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h 2019-11-23 04:28:46 UTC (rev 252824)
@@ -217,7 +217,6 @@
void didChangeTimerAlignmentInterval();
virtual Seconds domTimerAlignmentInterval(bool hasReachedMaxNestingLevel) const;
- virtual EventQueue& eventQueue() const = 0;
virtual EventTarget* errorEventTarget() = 0;
DatabaseContext* databaseContext() { return m_databaseContext.get(); }
Modified: trunk/Source/WebCore/dom/TaskSource.h (252823 => 252824)
--- trunk/Source/WebCore/dom/TaskSource.h 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/dom/TaskSource.h 2019-11-23 04:28:46 UTC (rev 252824)
@@ -29,6 +29,7 @@
enum class TaskSource : uint8_t {
DOMManipulation,
+ DatabaseAccess,
FileReading,
FontLoading,
IdleTask,
Modified: trunk/Source/WebCore/dom/WindowEventLoop.cpp (252823 => 252824)
--- trunk/Source/WebCore/dom/WindowEventLoop.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/dom/WindowEventLoop.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -52,6 +52,7 @@
inline WindowEventLoop::WindowEventLoop(const RegistrableDomain& domain)
: m_domain(domain)
+ , m_timer(*this, &WindowEventLoop::run)
{
}
@@ -63,9 +64,7 @@
void WindowEventLoop::scheduleToRun()
{
- callOnMainThread([eventLoop = makeRef(*this)] () {
- eventLoop->run();
- });
+ m_timer.startOneShot(0_s);
}
bool WindowEventLoop::isContextThread() const
Modified: trunk/Source/WebCore/dom/WindowEventLoop.h (252823 => 252824)
--- trunk/Source/WebCore/dom/WindowEventLoop.h 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/dom/WindowEventLoop.h 2019-11-23 04:28:46 UTC (rev 252824)
@@ -28,6 +28,7 @@
#include "DocumentIdentifier.h"
#include "EventLoop.h"
#include "RegistrableDomain.h"
+#include "Timer.h"
#include <wtf/HashSet.h>
namespace WebCore {
@@ -49,6 +50,7 @@
MicrotaskQueue& microtaskQueue() final;
RegistrableDomain m_domain;
+ Timer m_timer;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (252823 => 252824)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -377,7 +377,9 @@
m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation();
selectFrameElementInParentIfFullySelected();
m_frame->editor().respondToChangedSelection(oldSelection, options);
- m_frame->document()->enqueueDocumentEvent(Event::create(eventNames().selectionchangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+ // https://www.w3.org/TR/selection-api/#selectionchange-event
+ // FIXME: Spec doesn't specify which task source to use.
+ m_frame->document()->queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().selectionchangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
return true;
}
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (252823 => 252824)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -2124,8 +2124,9 @@
void DOMWindow::languagesChanged()
{
- if (auto* document = this->document())
- document->enqueueWindowEvent(Event::create(eventNames().languagechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+ // https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-languages
+ if (auto document = makeRefPtr(this->document()))
+ document->queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, Event::create(eventNames().languagechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
}
void DOMWindow::dispatchLoadEvent()
Modified: trunk/Source/WebCore/page/PointerCaptureController.cpp (252823 => 252824)
--- trunk/Source/WebCore/page/PointerCaptureController.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/page/PointerCaptureController.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -150,7 +150,8 @@
auto pointerId = static_cast<PointerID>(keyAndValue.key);
auto pointerType = capturingData.pointerType;
releasePointerCapture(&element, pointerId);
- element.document().enqueueDocumentEvent(PointerEvent::create(eventNames().lostpointercaptureEvent, pointerId, pointerType));
+ // FIXME: Spec doesn't specify which task soruce to use.
+ element.document().queueTaskToDispatchEvent(TaskSource::UserInteraction, PointerEvent::create(eventNames().lostpointercaptureEvent, pointerId, pointerType));
return;
}
}
Modified: trunk/Source/WebCore/page/PointerLockController.cpp (252823 => 252824)
--- trunk/Source/WebCore/page/PointerLockController.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/page/PointerLockController.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -215,8 +215,9 @@
void PointerLockController::enqueueEvent(const AtomString& type, Document* document)
{
- if (document)
- document->enqueueDocumentEvent(Event::create(type, Event::CanBubble::Yes, Event::IsCancelable::No));
+ // FIXME: Spec doesn't specify which task source use.
+ if (auto protectedDocument = makeRefPtr(document))
+ protectedDocument->queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(type, Event::CanBubble::Yes, Event::IsCancelable::No));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/storage/StorageEventDispatcher.cpp (252823 => 252824)
--- trunk/Source/WebCore/storage/StorageEventDispatcher.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/storage/StorageEventDispatcher.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -85,11 +85,10 @@
InspectorInstrumentation::didDispatchDOMStorageEvent(page, key, oldValue, newValue, StorageType::Session, securityOrigin.securityOrigin().ptr());
for (auto& frame : frames) {
- auto result = frame->document()->domWindow()->sessionStorage();
- if (!frame->document())
- continue;
- if (!result.hasException())
- frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
+ auto document = makeRefPtr(frame->document());
+ auto result = document->domWindow()->sessionStorage();
+ if (!result.hasException()) // https://html.spec.whatwg.org/multipage/webstorage.html#the-storage-event:event-storage
+ document->queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
}
}
@@ -99,11 +98,10 @@
InspectorInstrumentation::didDispatchDOMStorageEvent(*page, key, oldValue, newValue, StorageType::Local, securityOrigin.securityOrigin().ptr());
for (auto& frame : frames) {
- auto result = frame->document()->domWindow()->localStorage();
- if (!frame->document())
- continue;
- if (!result.hasException())
- frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
+ auto document = makeRefPtr(frame->document());
+ auto result = document->domWindow()->localStorage();
+ if (!result.hasException()) // https://html.spec.whatwg.org/multipage/webstorage.html#the-storage-event:event-storage
+ document->queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
}
}
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (252823 => 252824)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -70,7 +70,6 @@
, m_inspectorController(makeUnique<WorkerInspectorController>(*this))
, m_isOnline(isOnline)
, m_shouldBypassMainWorldContentSecurityPolicy(shouldBypassMainWorldContentSecurityPolicy)
- , m_eventQueue(*this)
, m_topOrigin(WTFMove(topOrigin))
#if ENABLE(INDEXED_DATABASE)
, m_connectionProxy(connectionProxy)
@@ -414,11 +413,6 @@
return m_script->isExecutionForbidden();
}
-WorkerEventQueue& WorkerGlobalScope::eventQueue() const
-{
- return m_eventQueue;
-}
-
#if ENABLE(WEB_CRYPTO)
class CryptoBufferContainer : public ThreadSafeRefCounted<CryptoBufferContainer> {
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (252823 => 252824)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.h 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h 2019-11-23 04:28:46 UTC (rev 252824)
@@ -34,7 +34,6 @@
#include "Supplementable.h"
#include <wtf/URL.h>
#include "WorkerCacheStorageConnection.h"
-#include "WorkerEventQueue.h"
#include "WorkerMessagePortChannelProvider.h"
#include "WorkerScriptController.h"
#include <_javascript_Core/ConsoleMessage.h>
@@ -161,7 +160,6 @@
void disableEval(const String& errorMessage) final;
void disableWebAssembly(const String& errorMessage) final;
EventTarget* errorEventTarget() final;
- WorkerEventQueue& eventQueue() const final;
String resourceRequestIdentifier() const final { return m_identifier; }
SocketProvider* socketProvider() final;
@@ -196,8 +194,6 @@
RefPtr<WorkerEventLoop> m_eventLoop;
std::unique_ptr<EventLoopTaskGroup> m_defaultTaskGroup;
- mutable WorkerEventQueue m_eventQueue;
-
Ref<SecurityOrigin> m_topOrigin;
#if ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp (252823 => 252824)
--- trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp 2019-11-23 04:28:46 UTC (rev 252824)
@@ -51,7 +51,6 @@
: m_document(makeWeakPtr(document))
, m_script(makeUnique<WorkletScriptController>(this))
, m_topOrigin(SecurityOrigin::createUnique())
- , m_eventQueue(*this)
, m_code(WTFMove(code))
{
auto addResult = allWorkletGlobalScopesSet().add(this);
Modified: trunk/Source/WebCore/worklets/WorkletGlobalScope.h (252823 => 252824)
--- trunk/Source/WebCore/worklets/WorkletGlobalScope.h 2019-11-23 03:30:12 UTC (rev 252823)
+++ trunk/Source/WebCore/worklets/WorkletGlobalScope.h 2019-11-23 04:28:46 UTC (rev 252824)
@@ -117,7 +117,6 @@
void addConsoleMessage(MessageSource, MessageLevel, const String&, unsigned long) final;
EventTarget* errorEventTarget() final { return this; }
- EventQueue& eventQueue() const final { ASSERT_NOT_REACHED(); return m_eventQueue; }
#if ENABLE(WEB_CRYPTO)
bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) final { RELEASE_ASSERT_NOT_REACHED(); return false; }
@@ -137,10 +136,6 @@
RefPtr<WorkerEventLoop> m_eventLoop;
std::unique_ptr<EventLoopTaskGroup> m_defaultTaskGroup;
- // FIXME: This is not implemented properly, it just satisfies the compiler.
- // https://bugs.webkit.org/show_bug.cgi?id=191136
- mutable WorkerEventQueue m_eventQueue;
-
JSC::RuntimeFlags m_jsRuntimeFlags;
ScriptSourceCode m_code;
};