Changeset 252824 in webkit


Ignore:
Timestamp:
Nov 22, 2019, 8:28:46 PM (5 years ago)
Author:
rniwa@webkit.org
Message:

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.

LayoutTests/imported/w3c:

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:

Source/WebCore:

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:
Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r252724 r252824  
     12019-11-21  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Use the event loop instead of DocumentEventQueue and WorkerEventQueue
     4        https://bugs.webkit.org/show_bug.cgi?id=204447
     5        <rdar://problem/57420691>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Updated the expected result. It now fails one step head due to EventLoop getting better integrated with timers.
     10
     11        * web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt:
     12
    1132019-11-20  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/requestidlecallback/callback-timeout-when-busy-expected.txt

    r251120 r252824  
    33
    44FAIL 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
    5 FAIL requestIdleCallback scheduled with timeout when event loop is busy. assert_true: Should only have been run after timeout expected true got false
     5FAIL 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
    66
  • trunk/Source/WebCore/ChangeLog

    r252823 r252824  
     12019-11-21  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Use the event loop instead of DocumentEventQueue and WorkerEventQueue
     4        https://bugs.webkit.org/show_bug.cgi?id=204447
     5        <rdar://problem/57420691>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        This patch replaces every use of DocumentEventQueue and WorkerEventQueue by the integration
     10        with the event loop.
     11
     12        Because this changes the order by which some of the affected events fire and tasks run,
     13        this patch also makes WindowEventLoop::scheduleToRun use a Timer instead of callOnMainThread
     14        in order to avoid introducing new test failures.
     15
     16        In addition, WebSQL needed a code change to scheudle tasks via the event loop after moving
     17        to the event loop as callOnMainThread could run before or after a 0s timer fires depending
     18        on whether it was called during another timer or not; meaning that it could change the order
     19        of operations with respect to other tasks scheduled via event loops in some cases.
     20
     21        Finally, added the links to various specifications where appropriate.
     22
     23        * Modules/indexeddb/IDBDatabase.cpp:
     24        (WebCore::IDBDatabase::connectionToServerLost):
     25        (WebCore::IDBDatabase::fireVersionChangeEvent):
     26        * Modules/indexeddb/IDBRequest.cpp:
     27        (WebCore::IDBRequest::enqueueEvent):
     28        * Modules/indexeddb/IDBTransaction.cpp:
     29        (WebCore::IDBTransaction::enqueueEvent):
     30        (WebCore::IDBTransaction::dispatchEvent):
     31        * Modules/mediastream/RTCDataChannel.cpp:
     32        (WebCore::RTCDataChannel::scheduleDispatchEvent):
     33        * Modules/webdatabase/Database.cpp:
     34        (WebCore::Database::scheduleTransactionCallback): Schedule a task on the event loop once
     35        we're in the main thread as the order of operation could change with respect to other tasks
     36        scheduled via the event loop otherwise.
     37        * Modules/webdatabase/SQLTransaction.cpp:
     38        (WebCore::SQLTransaction::notifyDatabaseThreadIsShuttingDown): Ditto.
     39        * dom/Document.cpp:
     40        (WebCore::Document::visibilityStateChanged):
     41        (WebCore::Document::prepareForDestruction):
     42        (WebCore::Document::enqueueWindowEvent): Deleted.
     43        (WebCore::Document::queueTaskToDispatchEvent): Added.
     44        (WebCore::Document::enqueueDocumentEvent): Deleted.
     45        (WebCore::Document::queueTaskToDispatchEventOnWindow): Added.
     46        (WebCore::Document::enqueueOverflowEvent):
     47        (WebCore::Document::enqueueSecurityPolicyViolationEvent):
     48        (WebCore::Document::enqueueHashchangeEvent): Rewritten. Keep the target node alive until
     49        the overflow event fires.
     50        fired on an overflow element
     51        * dom/Document.h:
     52        * dom/ScriptExecutionContext.h:
     53        * dom/TaskSource.h:
     54        * dom/WindowEventLoop.cpp:
     55        (WebCore::WindowEventLoop::WindowEventLoop):
     56        (WebCore::WindowEventLoop::scheduleToRun):
     57        * dom/WindowEventLoop.h:
     58        * editing/FrameSelection.cpp:
     59        (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
     60        * page/DOMWindow.cpp:
     61        (WebCore::DOMWindow::languagesChanged):
     62        * page/PointerCaptureController.cpp:
     63        (WebCore::PointerCaptureController::elementWasRemoved):
     64        * page/PointerLockController.cpp:
     65        (WebCore::PointerLockController::enqueueEvent):
     66        * storage/StorageEventDispatcher.cpp:
     67        (WebCore::StorageEventDispatcher::dispatchSessionStorageEventsToFrames):
     68        (WebCore::StorageEventDispatcher::dispatchLocalStorageEventsToFrames):
     69        * workers/WorkerGlobalScope.cpp:
     70        (WebCore::WorkerGlobalScope::WorkerGlobalScope):
     71        (WebCore::WorkerGlobalScope::eventQueue const): Deleted.
     72        * workers/WorkerGlobalScope.h:
     73        * worklets/WorkletGlobalScope.cpp:
     74        (WebCore::WorkletGlobalScope::WorkletGlobalScope):
     75        * worklets/WorkletGlobalScope.h:
     76
    1772019-11-22  Ryosuke Niwa  <rniwa@webkit.org>
    278
  • trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp

    r252642 r252824  
    280280
    281281    if (auto* context = scriptExecutionContext())
    282         context->eventQueue().enqueueEvent(WTFMove(errorEvent));
     282        queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(errorEvent));
    283283
    284284    auto closeEvent = Event::create(m_eventNames.closeEvent, Event::CanBubble::Yes, Event::IsCancelable::No);
     
    286286
    287287    if (auto* context = scriptExecutionContext())
    288         context->eventQueue().enqueueEvent(WTFMove(closeEvent));
     288        queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(closeEvent));
    289289}
    290290
     
    469469   
    470470    Ref<Event> event = IDBVersionChangeEvent::create(requestIdentifier, currentVersion, requestedVersion, m_eventNames.versionchangeEvent);
    471     event->setTarget(this);
    472     scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
     471    queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(event));
    473472}
    474473
  • trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp

    r252642 r252824  
    291291        return;
    292292
    293     event->setTarget(this);
    294     scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
     293    queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(event));
    295294}
    296295
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r252642 r252824  
    626626        return;
    627627
    628     event->setTarget(this);
    629     scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
     628    queueTaskToDispatchEvent(*this, TaskSource::DatabaseAccess, WTFMove(event));
    630629}
    631630
     
    637636    ASSERT(scriptExecutionContext());
    638637    ASSERT(!m_contextStopped);
    639     ASSERT(event.target() == this);
    640638    ASSERT(event.type() == eventNames().completeEvent || event.type() == eventNames().abortEvent);
    641639
  • trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp

    r250573 r252824  
    231231        return;
    232232
    233     event->setTarget(this);
    234     scriptExecutionContext()->eventQueue().enqueueEvent(WTFMove(event));
     233    // https://w3c.github.io/webrtc-pc/#operation
     234    queueTaskToDispatchEvent(*this, TaskSource::Networking, WTFMove(event));
    235235}
    236236
  • trunk/Source/WebCore/Modules/webdatabase/Database.cpp

    r252607 r252824  
    704704void Database::scheduleTransactionCallback(SQLTransaction* transaction)
    705705{
    706     callOnMainThread([transaction = makeRefPtr(transaction)] {
    707         transaction->performPendingCallback();
     706    callOnMainThread([this, protectedThis = makeRef(*this), transaction = makeRefPtr(transaction)] {
     707        m_document->eventLoop().queueTask(TaskSource::Networking, [transaction = transaction.copyRef()] {
     708            transaction->performPendingCallback();
     709        });
    708710    });
    709711}
  • trunk/Source/WebCore/Modules/webdatabase/SQLTransaction.cpp

    r252607 r252824  
    129129{
    130130    callOnMainThread([this, protectedThis = makeRef(*this)]() mutable {
    131         callErrorCallbackDueToInterruption();
     131        m_database->document().eventLoop().queueTask(TaskSource::Networking, [this, protectedThis = protectedThis.copyRef()]() mutable {
     132            callErrorCallbackDueToInterruption();
     133        });
    132134    });
    133135
  • trunk/Source/WebCore/dom/Document.cpp

    r252761 r252824  
    555555    , m_constantPropertyMap(makeUnique<ConstantPropertyMap>(*this))
    556556    , m_documentClasses(documentClasses)
    557     , m_eventQueue(*this)
    558557#if ENABLE(FULLSCREEN_API)
    559558    , m_fullscreenManager { makeUniqueRef<FullscreenManager>(*this) }
     
    17081707void Document::visibilityStateChanged()
    17091708{
    1710     enqueueDocumentEvent(Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
     1709    // // https://w3c.github.io/page-visibility/#reacting-to-visibilitychange-changes
     1710    queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
    17111711    for (auto* client : m_visibilityStateCallbackClients)
    17121712        client->visibilityStateChanged();
     
    25332533
    25342534    stopActiveDOMObjects();
    2535     m_eventQueue.close();
    25362535#if ENABLE(FULLSCREEN_API)
    25372536    m_fullscreenManager->emptyEventQueue();
     
    47384737}
    47394738
    4740 void Document::enqueueWindowEvent(Ref<Event>&& event)
    4741 {
    4742     event->setTarget(m_domWindow.get());
    4743     m_eventQueue.enqueueEvent(WTFMove(event));
    4744 }
    4745 
    4746 void Document::enqueueDocumentEvent(Ref<Event>&& event)
    4747 {
    4748     event->setTarget(this);
    4749     m_eventQueue.enqueueEvent(WTFMove(event));
     4739void Document::queueTaskToDispatchEvent(TaskSource source, Ref<Event>&& event)
     4740{
     4741    eventLoop().queueTask(source, [document = makeRef(*this), event = WTFMove(event)] {
     4742        document->dispatchEvent(event);
     4743    });
     4744}
     4745
     4746void Document::queueTaskToDispatchEventOnWindow(TaskSource source, Ref<Event>&& event)
     4747{
     4748    eventLoop().queueTask(source, [this, protectedThis = makeRef(*this), event = WTFMove(event)] {
     4749        if (!m_domWindow)
     4750            return;
     4751        m_domWindow->dispatchEvent(event);
     4752    });
    47504753}
    47514754
    47524755void Document::enqueueOverflowEvent(Ref<Event>&& event)
    47534756{
    4754     m_eventQueue.enqueueEvent(WTFMove(event));
     4757    // https://developer.mozilla.org/en-US/docs/Web/API/Element/overflow_event
     4758    // FIXME: This event is totally unspecified.
     4759    auto* target = event->target();
     4760    RELEASE_ASSERT(target);
     4761    RELEASE_ASSERT(is<Node>(target));
     4762    eventLoop().queueTask(TaskSource::DOMManipulation, [protectedTarget = GCReachableRef<Node>(downcast<Node>(*target)), event = WTFMove(event)] {
     4763        protectedTarget->dispatchEvent(event);
     4764    });
    47554765}
    47564766
     
    63736383void Document::enqueueSecurityPolicyViolationEvent(SecurityPolicyViolationEvent::Init&& eventInit)
    63746384{
    6375     enqueueDocumentEvent(SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, WTFMove(eventInit), Event::IsTrusted::Yes));
     6385    queueTaskToDispatchEvent(TaskSource::DOMManipulation, SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, WTFMove(eventInit), Event::IsTrusted::Yes));
    63766386}
    63776387
    63786388void Document::enqueueHashchangeEvent(const String& oldURL, const String& newURL)
    63796389{
    6380     enqueueWindowEvent(HashChangeEvent::create(oldURL, newURL));
     6390    // FIXME: popstate event and hashchange event are supposed to fire in a single task.
     6391    queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, HashChangeEvent::create(oldURL, newURL));
    63816392}
    63826393
  • trunk/Source/WebCore/dom/Document.h

    r252646 r252824  
    11691169    bool isJSExecutionForbidden() const final { return false; }
    11701170
    1171     void enqueueWindowEvent(Ref<Event>&&);
    1172     void enqueueDocumentEvent(Ref<Event>&&);
     1171    void queueTaskToDispatchEvent(TaskSource, Ref<Event>&&);
     1172    void queueTaskToDispatchEventOnWindow(TaskSource, Ref<Event>&&);
    11731173    void enqueueOverflowEvent(Ref<Event>&&);
    11741174    void dispatchPageshowEvent(PageshowEventPersistence);
     
    11761176    void enqueueHashchangeEvent(const String& oldURL, const String& newURL);
    11771177    void dispatchPopstateEvent(RefPtr<SerializedScriptValue>&& stateObject);
    1178     DocumentEventQueue& eventQueue() const final { return m_eventQueue; }
    11791178
    11801179    WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener&);
     
    18261825
    18271826    RenderPtr<RenderView> m_renderView;
    1828     mutable DocumentEventQueue m_eventQueue;
    18291827
    18301828    HashSet<MediaCanStartListener*> m_mediaCanStartListeners;
  • trunk/Source/WebCore/dom/ScriptExecutionContext.h

    r252646 r252824  
    218218    virtual Seconds domTimerAlignmentInterval(bool hasReachedMaxNestingLevel) const;
    219219
    220     virtual EventQueue& eventQueue() const = 0;
    221220    virtual EventTarget* errorEventTarget() = 0;
    222221
  • trunk/Source/WebCore/dom/TaskSource.h

    r252820 r252824  
    3030enum class TaskSource : uint8_t {
    3131    DOMManipulation,
     32    DatabaseAccess,
    3233    FileReading,
    3334    FontLoading,
  • trunk/Source/WebCore/dom/WindowEventLoop.cpp

    r252723 r252824  
    5353inline WindowEventLoop::WindowEventLoop(const RegistrableDomain& domain)
    5454    : m_domain(domain)
     55    , m_timer(*this, &WindowEventLoop::run)
    5556{
    5657}
     
    6465void WindowEventLoop::scheduleToRun()
    6566{
    66     callOnMainThread([eventLoop = makeRef(*this)] () {
    67         eventLoop->run();
    68     });
     67    m_timer.startOneShot(0_s);
    6968}
    7069
  • trunk/Source/WebCore/dom/WindowEventLoop.h

    r252723 r252824  
    2929#include "EventLoop.h"
    3030#include "RegistrableDomain.h"
     31#include "Timer.h"
    3132#include <wtf/HashSet.h>
    3233
     
    5051
    5152    RegistrableDomain m_domain;
     53    Timer m_timer;
    5254};
    5355
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r252546 r252824  
    378378    selectFrameElementInParentIfFullySelected();
    379379    m_frame->editor().respondToChangedSelection(oldSelection, options);
    380     m_frame->document()->enqueueDocumentEvent(Event::create(eventNames().selectionchangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
     380    // https://www.w3.org/TR/selection-api/#selectionchange-event
     381    // FIXME: Spec doesn't specify which task source to use.
     382    m_frame->document()->queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().selectionchangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
    381383
    382384    return true;
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r252546 r252824  
    21252125void DOMWindow::languagesChanged()
    21262126{
    2127     if (auto* document = this->document())
    2128         document->enqueueWindowEvent(Event::create(eventNames().languagechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
     2127    // https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-languages
     2128    if (auto document = makeRefPtr(this->document()))
     2129        document->queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, Event::create(eventNames().languagechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
    21292130}
    21302131
  • trunk/Source/WebCore/page/PointerCaptureController.cpp

    r251320 r252824  
    151151            auto pointerType = capturingData.pointerType;
    152152            releasePointerCapture(&element, pointerId);
    153             element.document().enqueueDocumentEvent(PointerEvent::create(eventNames().lostpointercaptureEvent, pointerId, pointerType));
     153            // FIXME: Spec doesn't specify which task soruce to use.
     154            element.document().queueTaskToDispatchEvent(TaskSource::UserInteraction, PointerEvent::create(eventNames().lostpointercaptureEvent, pointerId, pointerType));
    154155            return;
    155156        }
  • trunk/Source/WebCore/page/PointerLockController.cpp

    r251041 r252824  
    216216void PointerLockController::enqueueEvent(const AtomString& type, Document* document)
    217217{
    218     if (document)
    219         document->enqueueDocumentEvent(Event::create(type, Event::CanBubble::Yes, Event::IsCancelable::No));
     218    // FIXME: Spec doesn't specify which task source use.
     219    if (auto protectedDocument = makeRefPtr(document))
     220        protectedDocument->queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(type, Event::CanBubble::Yes, Event::IsCancelable::No));
    220221}
    221222
  • trunk/Source/WebCore/storage/StorageEventDispatcher.cpp

    r230211 r252824  
    8686
    8787    for (auto& frame : frames) {
    88         auto result = frame->document()->domWindow()->sessionStorage();
    89         if (!frame->document())
    90             continue;
    91         if (!result.hasException())
    92             frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
     88        auto document = makeRefPtr(frame->document());
     89        auto result = document->domWindow()->sessionStorage();
     90        if (!result.hasException()) // https://html.spec.whatwg.org/multipage/webstorage.html#the-storage-event:event-storage
     91            document->queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
    9392    }
    9493}
     
    10099
    101100    for (auto& frame : frames) {
    102         auto result = frame->document()->domWindow()->localStorage();
    103         if (!frame->document())
    104             continue;
    105         if (!result.hasException())
    106             frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
     101        auto document = makeRefPtr(frame->document());
     102        auto result = document->domWindow()->localStorage();
     103        if (!result.hasException()) // https://html.spec.whatwg.org/multipage/webstorage.html#the-storage-event:event-storage
     104            document->queueTaskToDispatchEventOnWindow(TaskSource::DOMManipulation, StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, url, result.releaseReturnValue()));
    107105    }
    108106}
  • trunk/Source/WebCore/workers/WorkerGlobalScope.cpp

    r252723 r252824  
    7171    , m_isOnline(isOnline)
    7272    , m_shouldBypassMainWorldContentSecurityPolicy(shouldBypassMainWorldContentSecurityPolicy)
    73     , m_eventQueue(*this)
    7473    , m_topOrigin(WTFMove(topOrigin))
    7574#if ENABLE(INDEXED_DATABASE)
     
    413412{
    414413    return m_script->isExecutionForbidden();
    415 }
    416 
    417 WorkerEventQueue& WorkerGlobalScope::eventQueue() const
    418 {
    419     return m_eventQueue;
    420414}
    421415
  • trunk/Source/WebCore/workers/WorkerGlobalScope.h

    r252723 r252824  
    3535#include <wtf/URL.h>
    3636#include "WorkerCacheStorageConnection.h"
    37 #include "WorkerEventQueue.h"
    3837#include "WorkerMessagePortChannelProvider.h"
    3938#include "WorkerScriptController.h"
     
    162161    void disableWebAssembly(const String& errorMessage) final;
    163162    EventTarget* errorEventTarget() final;
    164     WorkerEventQueue& eventQueue() const final;
    165163    String resourceRequestIdentifier() const final { return m_identifier; }
    166164    SocketProvider* socketProvider() final;
     
    196194    RefPtr<WorkerEventLoop> m_eventLoop;
    197195    std::unique_ptr<EventLoopTaskGroup> m_defaultTaskGroup;
    198 
    199     mutable WorkerEventQueue m_eventQueue;
    200196
    201197    Ref<SecurityOrigin> m_topOrigin;
  • trunk/Source/WebCore/worklets/WorkletGlobalScope.cpp

    r252723 r252824  
    5252    , m_script(makeUnique<WorkletScriptController>(this))
    5353    , m_topOrigin(SecurityOrigin::createUnique())
    54     , m_eventQueue(*this)
    5554    , m_code(WTFMove(code))
    5655{
  • trunk/Source/WebCore/worklets/WorkletGlobalScope.h

    r252607 r252824  
    118118
    119119    EventTarget* errorEventTarget() final { return this; }
    120     EventQueue& eventQueue() const final { ASSERT_NOT_REACHED(); return m_eventQueue; }
    121120
    122121#if ENABLE(WEB_CRYPTO)
     
    138137    std::unique_ptr<EventLoopTaskGroup> m_defaultTaskGroup;
    139138
    140     // FIXME: This is not implemented properly, it just satisfies the compiler.
    141     // https://bugs.webkit.org/show_bug.cgi?id=191136
    142     mutable WorkerEventQueue m_eventQueue;
    143 
    144139    JSC::RuntimeFlags m_jsRuntimeFlags;
    145140    ScriptSourceCode m_code;
Note: See TracChangeset for help on using the changeset viewer.