SWClientConnection should not double hop to fire some events
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:55:01 +0000 (22:55 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 22:55:01 +0000 (22:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196735

Reviewed by Alex Christensen.

Source/WebCore:

Some events, like postMessage in service workers is hopping from main thread to service worker thread to dispatch events.
Some other events, like service worker state update, are hopping from main thread to service worker thread, then posting a task to dispatch events.
This may create ordering problems.

To fix the issue, we now hop to the service worker thread and dispatch the events.
In addition, for documents, we post a task and do the whole service worker processing in it.
This ensures that some tests, like whether there is a service worker container,
or creation of a service worker are done consistently.

Covered by unflaked test.

* workers/service/SWClientConnection.cpp:
(WebCore::SWClientConnection::updateRegistrationState):
(WebCore::SWClientConnection::updateWorkerState):
(WebCore::SWClientConnection::fireUpdateFoundEvent):
(WebCore::SWClientConnection::notifyClientsOfControllerChange):
* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::updateState):
* workers/service/ServiceWorker.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::updateRegistrationState):
(WebCore::ServiceWorkerContainer::fireUpdateFoundEvent):
(WebCore::ServiceWorkerContainer::fireControllerChangeEvent):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::notifyFinished):
Notify of the script URL in the error message.
This will help diagnose flakiness issues.
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::fireUpdateFoundEvent):
* workers/service/ServiceWorkerRegistration.h:

Source/WebKit:

Removed unnecessary method.

* WebProcess/Storage/WebSWClientConnection.cpp:
* WebProcess/Storage/WebSWClientConnection.h:

LayoutTests:

* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244160 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/workers/service/SWClientConnection.cpp
Source/WebCore/workers/service/SWClientConnection.h
Source/WebCore/workers/service/ServiceWorker.cpp
Source/WebCore/workers/service/ServiceWorker.h
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.h
Source/WebCore/workers/service/ServiceWorkerJob.cpp
Source/WebCore/workers/service/ServiceWorkerRegistration.cpp
Source/WebCore/workers/service/ServiceWorkerRegistration.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.h

index 27eeedd..2899fe0 100644 (file)
@@ -1,3 +1,12 @@
+2019-04-10  Youenn Fablet  <youenn@apple.com>
+
+        SWClientConnection should not double hop to fire some events
+        https://bugs.webkit.org/show_bug.cgi?id=196735
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk2/TestExpectations:
+
 2019-04-10  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: REGRESSION (r238602): Elements: deleting the last child of a collapsed parent selects the parent's next sibling
index 2c0e580..d4f5a89 100644 (file)
@@ -64,8 +64,6 @@ webkit.org/b/187183 http/tests/security/pasteboard-file-url.html [ Pass ]
 
 [ Mojave+ ] fast/canvas/webgl/context-update-on-display-configuration.html [ Pass ]
 
-webkit.org/b/190828 [ Mojave+ Debug ]  http/tests/workers/service/self_registration.html [ Pass Failure ]
-
 fast/misc/valid-primary-screen-displayID.html [ Pass ]
 
 # Skipped because of <rdar://problem/45388584>.
index f737c8a..fc83803 100644 (file)
@@ -1,3 +1,42 @@
+2019-04-10  Youenn Fablet  <youenn@apple.com>
+
+        SWClientConnection should not double hop to fire some events
+        https://bugs.webkit.org/show_bug.cgi?id=196735
+
+        Reviewed by Alex Christensen.
+
+        Some events, like postMessage in service workers is hopping from main thread to service worker thread to dispatch events.
+        Some other events, like service worker state update, are hopping from main thread to service worker thread, then posting a task to dispatch events.
+        This may create ordering problems.
+
+        To fix the issue, we now hop to the service worker thread and dispatch the events.
+        In addition, for documents, we post a task and do the whole service worker processing in it.
+        This ensures that some tests, like whether there is a service worker container,
+        or creation of a service worker are done consistently.
+
+        Covered by unflaked test.
+
+        * workers/service/SWClientConnection.cpp:
+        (WebCore::SWClientConnection::updateRegistrationState):
+        (WebCore::SWClientConnection::updateWorkerState):
+        (WebCore::SWClientConnection::fireUpdateFoundEvent):
+        (WebCore::SWClientConnection::notifyClientsOfControllerChange):
+        * workers/service/ServiceWorker.cpp:
+        (WebCore::ServiceWorker::updateState):
+        * workers/service/ServiceWorker.h:
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::updateRegistrationState):
+        (WebCore::ServiceWorkerContainer::fireUpdateFoundEvent):
+        (WebCore::ServiceWorkerContainer::fireControllerChangeEvent):
+        * workers/service/ServiceWorkerContainer.h:
+        * workers/service/ServiceWorkerJob.cpp:
+        (WebCore::ServiceWorkerJob::notifyFinished):
+        Notify of the script URL in the error message.
+        This will help diagnose flakiness issues.
+        * workers/service/ServiceWorkerRegistration.cpp:
+        (WebCore::ServiceWorkerRegistration::fireUpdateFoundEvent):
+        * workers/service/ServiceWorkerRegistration.h:
+
 2019-04-10  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Timelines: can't reliably stop/start a recording
index f025f93..9a3140e 100644 (file)
@@ -116,7 +116,7 @@ void SWClientConnection::startScriptFetchForServer(ServiceWorkerJobIdentifier jo
 }
 
 
-void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&& message, ServiceWorkerData&& sourceData, const String& sourceOrigin)
+void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&& message, ServiceWorkerData&& sourceData, String&& sourceOrigin)
 {
     ASSERT(isMainThread());
 
@@ -125,14 +125,10 @@ void SWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier des
     if (!destinationDocument)
         return;
 
-    auto* container = destinationDocument->serviceWorkerContainer();
-    if (!container)
-        return;
-
-    MessageEventSource source = RefPtr<ServiceWorker> { ServiceWorker::getOrCreate(*destinationDocument, WTFMove(sourceData)) };
-
-    auto messageEvent = MessageEvent::create(MessagePort::entanglePorts(*destinationDocument, WTFMove(message.transferredPorts)), message.message.releaseNonNull(), sourceOrigin, { }, WTFMove(source));
-    container->dispatchEvent(messageEvent);
+    destinationDocument->postTask([message = WTFMove(message), sourceData = WTFMove(sourceData), sourceOrigin = WTFMove(sourceOrigin)](auto& context) mutable {
+        if (auto* container = context.serviceWorkerContainer())
+            container->postMessage(WTFMove(message), WTFMove(sourceData), WTFMove(sourceOrigin));
+    });
 }
 
 void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const Optional<ServiceWorkerData>& serviceWorkerData)
@@ -142,13 +138,15 @@ void SWClientConnection::updateRegistrationState(ServiceWorkerRegistrationIdenti
     SWContextManager::singleton().forEachServiceWorkerThread([identifier, state, &serviceWorkerData] (auto& workerThread) {
         workerThread.thread().runLoop().postTask([identifier, state, serviceWorkerData = crossThreadCopy(serviceWorkerData)](ScriptExecutionContext& context) mutable {
             if (auto* container = context.serviceWorkerContainer())
-                container->scheduleTaskToUpdateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
+                container->updateRegistrationState(identifier, state, WTFMove(serviceWorkerData));
         });
     });
 
     for (auto* document : Document::allDocuments()) {
-        if (auto* container = document->serviceWorkerContainer())
-            container->scheduleTaskToUpdateRegistrationState(identifier, state, serviceWorkerData);
+        document->postTask([identifier, state, serviceWorkerData, document](auto&) {
+            if (auto* container = document->serviceWorkerContainer())
+                container->updateRegistrationState(identifier, state, serviceWorkerData);
+        });
     }
 }
 
@@ -159,13 +157,15 @@ void SWClientConnection::updateWorkerState(ServiceWorkerIdentifier identifier, S
     SWContextManager::singleton().forEachServiceWorkerThread([identifier, state] (auto& workerThread) {
         workerThread.thread().runLoop().postTask([identifier, state](ScriptExecutionContext& context) {
             if (auto* serviceWorker = context.serviceWorker(identifier))
-                serviceWorker->scheduleTaskToUpdateState(state);
+                serviceWorker->updateState(state);
         });
     });
 
     for (auto* document : Document::allDocuments()) {
-        if (auto* serviceWorker = document->serviceWorker(identifier))
-            serviceWorker->scheduleTaskToUpdateState(state);
+        document->postTask([identifier, document, state](auto&) {
+            if (auto* serviceWorker = document->serviceWorker(identifier))
+                serviceWorker->updateState(state);
+        });
     }
 }
 
@@ -176,13 +176,15 @@ void SWClientConnection::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifie
     SWContextManager::singleton().forEachServiceWorkerThread([identifier] (auto& workerThread) {
         workerThread.thread().runLoop().postTask([identifier](ScriptExecutionContext& context) {
             if (auto* container = context.serviceWorkerContainer())
-                container->scheduleTaskToFireUpdateFoundEvent(identifier);
+                container->fireUpdateFoundEvent(identifier);
         });
     });
 
     for (auto* document : Document::allDocuments()) {
-        if (auto* container = document->serviceWorkerContainer())
-            container->scheduleTaskToFireUpdateFoundEvent(identifier);
+        document->postTask([document, identifier](auto&) {
+            if (auto* container = document->serviceWorkerContainer())
+                container->fireUpdateFoundEvent(identifier);
+        });
     }
 }
 
@@ -239,10 +241,12 @@ void SWClientConnection::notifyClientsOfControllerChange(const HashSet<DocumentI
         if (!client)
             continue;
 
-        ASSERT(!client->activeServiceWorker() || client->activeServiceWorker()->identifier() != newController.identifier);
-        client->setActiveServiceWorker(ServiceWorker::getOrCreate(*client, ServiceWorkerData { newController }));
-        if (auto* container = client->serviceWorkerContainer())
-            container->scheduleTaskToFireControllerChangeEvent();
+        client->postTask([client, contextIdentifiers, newController = WTFMove(newController)](auto&) {
+            ASSERT(!client->activeServiceWorker() || client->activeServiceWorker()->identifier() != newController.identifier);
+            client->setActiveServiceWorker(ServiceWorker::getOrCreate(*client, ServiceWorkerData { newController }));
+            if (auto* container = client->serviceWorkerContainer())
+                container->fireControllerChangeEvent();
+        });
     }
 }
 
index 3c00914..1fc7162 100644 (file)
@@ -92,7 +92,7 @@ protected:
     WEBCORE_EXPORT void registrationJobResolvedInServer(ServiceWorkerJobIdentifier, ServiceWorkerRegistrationData&&, ShouldNotifyWhenResolved);
     WEBCORE_EXPORT void unregistrationJobResolvedInServer(ServiceWorkerJobIdentifier, bool unregistrationResult);
     WEBCORE_EXPORT void startScriptFetchForServer(ServiceWorkerJobIdentifier, const ServiceWorkerRegistrationKey&, FetchOptions::Cache);
-    WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&&, ServiceWorkerData&& source, const String& sourceOrigin);
+    WEBCORE_EXPORT void postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&&, ServiceWorkerData&& source, String&& sourceOrigin);
     WEBCORE_EXPORT void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const Optional<ServiceWorkerData>&);
     WEBCORE_EXPORT void updateWorkerState(ServiceWorkerIdentifier, ServiceWorkerState);
     WEBCORE_EXPORT void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier);
index b240f09..e52e49e 100644 (file)
@@ -78,24 +78,16 @@ ServiceWorker::~ServiceWorker()
         context->unregisterServiceWorker(*this);
 }
 
-void ServiceWorker::scheduleTaskToUpdateState(State state)
+void ServiceWorker::updateState(State state)
 {
-    auto* context = scriptExecutionContext();
-    if (!context)
-        return;
-
-    context->postTask([this, protectedThis = makeRef(*this), state](ScriptExecutionContext&) {
-        ASSERT(this->state() != state);
-
-        WORKER_RELEASE_LOG_IF_ALLOWED("scheduleTaskToUpdateState: Updating service worker %llu state from %hhu to %hhu. Registration ID: %llu", identifier().toUInt64(), m_data.state, state, registrationIdentifier().toUInt64());
-        m_data.state = state;
-        if (state != State::Installing && !m_isStopped) {
-            ASSERT(m_pendingActivityForEventDispatch);
-            dispatchEvent(Event::create(eventNames().statechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
-        }
+    WORKER_RELEASE_LOG_IF_ALLOWED("updateState: Updating service worker %llu state from %hhu to %hhu. Registration ID: %llu", identifier().toUInt64(), m_data.state, state, registrationIdentifier().toUInt64());
+    m_data.state = state;
+    if (state != State::Installing && !m_isStopped) {
+        ASSERT(m_pendingActivityForEventDispatch);
+        dispatchEvent(Event::create(eventNames().statechangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
+    }
 
-        updatePendingActivityForEventDispatch();
-    });
+    updatePendingActivityForEventDispatch();
 }
 
 ExceptionOr<void> ServiceWorker::postMessage(ScriptExecutionContext& context, JSC::JSValue messageValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
index df20df2..eba65ca 100644 (file)
@@ -55,7 +55,7 @@ public:
 
     State state() const { return m_data.state; }
     
-    void scheduleTaskToUpdateState(State);
+    void updateState(State);
 
     ExceptionOr<void> postMessage(ScriptExecutionContext&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&&);
 
index 4902b6a..3d849c5 100644 (file)
@@ -311,20 +311,17 @@ void ServiceWorkerContainer::didFinishGetRegistrationRequest(uint64_t pendingPro
     pendingPromise->promise->resolve<IDLInterface<ServiceWorkerRegistration>>(WTFMove(registration));
 }
 
-void ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const Optional<ServiceWorkerData>& serviceWorkerData)
+void ServiceWorkerContainer::updateRegistrationState(ServiceWorkerRegistrationIdentifier identifier, ServiceWorkerRegistrationState state, const Optional<ServiceWorkerData>& serviceWorkerData)
 {
-    auto* context = scriptExecutionContext();
-    if (!context)
+    if (m_isStopped)
         return;
 
     RefPtr<ServiceWorker> serviceWorker;
     if (serviceWorkerData)
-        serviceWorker = ServiceWorker::getOrCreate(*context, ServiceWorkerData { *serviceWorkerData });
+        serviceWorker = ServiceWorker::getOrCreate(*scriptExecutionContext(), ServiceWorkerData { *serviceWorkerData });
 
-    context->postTask([this, protectedThis = makeRef(*this), identifier, state, serviceWorker = WTFMove(serviceWorker)](ScriptExecutionContext&) mutable {
-        if (auto* registration = m_registrations.get(identifier))
-            registration->updateStateFromServer(state, WTFMove(serviceWorker));
-    });
+    if (auto* registration = m_registrations.get(identifier))
+        registration->updateStateFromServer(state, WTFMove(serviceWorker));
 }
 
 void ServiceWorkerContainer::getRegistrations(Ref<DeferredPromise>&& promise)
@@ -407,14 +404,14 @@ void ServiceWorkerContainer::jobFailedWithException(ServiceWorkerJob& job, const
     }
 }
 
-void ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
+void ServiceWorkerContainer::fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier identifier)
 {
 #ifndef NDEBUG
     ASSERT(m_creationThread.ptr() == &Thread::current());
 #endif
 
     if (auto* registration = m_registrations.get(identifier))
-        registration->scheduleTaskToFireUpdateFoundEvent();
+        registration->fireUpdateFoundEvent();
 }
 
 void ServiceWorkerContainer::jobResolvedWithRegistration(ServiceWorkerJob& job, ServiceWorkerRegistrationData&& data, ShouldNotifyWhenResolved shouldNotifyWhenResolved)
@@ -471,6 +468,15 @@ void ServiceWorkerContainer::jobResolvedWithRegistration(ServiceWorkerJob& job,
     });
 }
 
+void ServiceWorkerContainer::postMessage(MessageWithMessagePorts&& message, ServiceWorkerData&& sourceData, String&& sourceOrigin)
+{
+    auto& context = *scriptExecutionContext();
+    MessageEventSource source = RefPtr<ServiceWorker> { ServiceWorker::getOrCreate(context, WTFMove(sourceData)) };
+
+    auto messageEvent = MessageEvent::create(MessagePort::entanglePorts(context, WTFMove(message.transferredPorts)), message.message.releaseNonNull(), sourceOrigin, { }, WTFMove(source));
+    dispatchEvent(messageEvent);
+}
+
 void ServiceWorkerContainer::notifyRegistrationIsSettled(const ServiceWorkerRegistrationKey& registrationKey)
 {
     callOnMainThread([connection = m_swConnection, registrationKey = registrationKey.isolatedCopy()] {
@@ -617,7 +623,7 @@ void ServiceWorkerContainer::removeRegistration(ServiceWorkerRegistration& regis
     m_registrations.remove(registration.identifier());
 }
 
-void ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent()
+void ServiceWorkerContainer::fireControllerChangeEvent()
 {
 #ifndef NDEBUG
     ASSERT(m_creationThread.ptr() == &Thread::current());
@@ -626,12 +632,7 @@ void ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent()
     if (m_isStopped)
         return;
 
-    scriptExecutionContext()->postTask([this, protectedThis = makeRef(*this)](ScriptExecutionContext&) mutable {
-        if (m_isStopped)
-            return;
-
-        dispatchEvent(Event::create(eventNames().controllerchangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
-    });
+    dispatchEvent(Event::create(eventNames().controllerchangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
 }
 
 void ServiceWorkerContainer::stop()
index 671404d..83165f0 100644 (file)
@@ -66,9 +66,11 @@ public:
     void updateRegistration(const URL& scopeURL, const URL& scriptURL, WorkerType, RefPtr<DeferredPromise>&&);
 
     void getRegistration(const String& clientURL, Ref<DeferredPromise>&&);
-    void scheduleTaskToUpdateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const Optional<ServiceWorkerData>&);
-    void scheduleTaskToFireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier);
-    void scheduleTaskToFireControllerChangeEvent();
+    void updateRegistrationState(ServiceWorkerRegistrationIdentifier, ServiceWorkerRegistrationState, const Optional<ServiceWorkerData>&);
+    void fireUpdateFoundEvent(ServiceWorkerRegistrationIdentifier);
+    void fireControllerChangeEvent();
+
+    void postMessage(MessageWithMessagePorts&&, ServiceWorkerData&& sourceData, String&& sourceOrigin);
 
     void getRegistrations(Ref<DeferredPromise>&&);
 
index 5b031b1..af2daec 100644 (file)
@@ -164,7 +164,7 @@ void ServiceWorkerJob::notifyFinished()
     auto& error = scriptLoader->error();
     ASSERT(!error.isNull());
 
-    m_client.jobFailedLoadingScript(*this, error, Exception { error.isAccessControl() ? SecurityError : TypeError, "Script load failed"_s });
+    m_client.jobFailedLoadingScript(*this, error, Exception { error.isAccessControl() ? SecurityError : TypeError, makeString("Script ", scriptLoader->url().string(), " load failed") });
 }
 
 bool ServiceWorkerJob::cancelPendingLoad()
index b90dff7..079b1ed 100644 (file)
@@ -206,20 +206,15 @@ void ServiceWorkerRegistration::updateStateFromServer(ServiceWorkerRegistrationS
     updatePendingActivityForEventDispatch();
 }
 
-void ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent()
+void ServiceWorkerRegistration::fireUpdateFoundEvent()
 {
     if (m_isStopped)
         return;
 
-    scriptExecutionContext()->postTask([this, protectedThis = makeRef(*this)](ScriptExecutionContext&) {
-        if (m_isStopped)
-            return;
+    REGISTRATION_RELEASE_LOG_IF_ALLOWED("fireUpdateFoundEvent: Firing updatefound event for registration %llu", identifier().toUInt64());
 
-        REGISTRATION_RELEASE_LOG_IF_ALLOWED("scheduleTaskToFireUpdateFoundEvent: Firing updatefound event for registration %llu", identifier().toUInt64());
-
-        ASSERT(m_pendingActivityForEventDispatch);
-        dispatchEvent(Event::create(eventNames().updatefoundEvent, Event::CanBubble::No, Event::IsCancelable::No));
-    });
+    ASSERT(m_pendingActivityForEventDispatch);
+    dispatchEvent(Event::create(eventNames().updatefoundEvent, Event::CanBubble::No, Event::IsCancelable::No));
 }
 
 EventTargetInterface ServiceWorkerRegistration::eventTargetInterface() const
index 3a0665a..ef86f99 100644 (file)
@@ -76,7 +76,7 @@ public:
     const ServiceWorkerRegistrationData& data() const { return m_registrationData; }
 
     void updateStateFromServer(ServiceWorkerRegistrationState, RefPtr<ServiceWorker>&&);
-    void scheduleTaskToFireUpdateFoundEvent();
+    void fireUpdateFoundEvent();
 
 private:
     ServiceWorkerRegistration(ScriptExecutionContext&, Ref<ServiceWorkerContainer>&&, ServiceWorkerRegistrationData&&);
index d88f460..43125b9 100644 (file)
@@ -1,3 +1,15 @@
+2019-04-10  Youenn Fablet  <youenn@apple.com>
+
+        SWClientConnection should not double hop to fire some events
+        https://bugs.webkit.org/show_bug.cgi?id=196735
+
+        Reviewed by Alex Christensen.
+
+        Removed unnecessary method.
+
+        * WebProcess/Storage/WebSWClientConnection.cpp:
+        * WebProcess/Storage/WebSWClientConnection.h:
+
 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
 
         [iOS] Fix iokit-get-properties sandbox violations
index a7b0e15..7905b63 100644 (file)
@@ -213,11 +213,6 @@ void WebSWClientConnection::continueDidReceiveFetchResponse(FetchIdentifier fetc
     send(Messages::WebSWServerConnection::ContinueDidReceiveFetchResponse { serviceWorkerRegistrationIdentifier, fetchIdentifier });
 }
 
-void WebSWClientConnection::postMessageToServiceWorkerClient(DocumentIdentifier destinationContextIdentifier, MessageWithMessagePorts&& message, ServiceWorkerData&& source, const String& sourceOrigin)
-{
-    SWClientConnection::postMessageToServiceWorkerClient(destinationContextIdentifier, WTFMove(message), WTFMove(source), sourceOrigin);
-}
-
 void WebSWClientConnection::connectionToServerLost()
 {
     auto registrationTasks = WTFMove(m_ongoingMatchRegistrationTasks);
index 58d69da..63e18d5 100644 (file)
@@ -65,8 +65,6 @@ public:
     void cancelFetch(WebCore::FetchIdentifier, WebCore::ServiceWorkerRegistrationIdentifier);
     void continueDidReceiveFetchResponse(WebCore::FetchIdentifier, WebCore::ServiceWorkerRegistrationIdentifier);
 
-    void postMessageToServiceWorkerClient(WebCore::DocumentIdentifier destinationContextIdentifier, WebCore::MessageWithMessagePorts&&, WebCore::ServiceWorkerData&& source, const String& sourceOrigin);
-
     void connectionToServerLost();
 
     void syncTerminateWorker(WebCore::ServiceWorkerIdentifier) final;