Diff
Modified: trunk/LayoutTests/ChangeLog (224771 => 224772)
--- trunk/LayoutTests/ChangeLog 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/LayoutTests/ChangeLog 2017-11-13 21:06:23 UTC (rev 224772)
@@ -1,3 +1,18 @@
+2017-11-13 Chris Dumez <[email protected]>
+
+ Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=179618
+
+ Reviewed by Brady Eidson.
+
+ Add layout test coverage.
+
+ * http/tests/workers/service/basic-unregister-then-register-again-reuse-expected.txt: Added.
+ * http/tests/workers/service/basic-unregister-then-register-again-reuse.html: Added.
+ * http/tests/workers/service/resources/basic-unregister-then-register-again-reuse-worker.js: Added.
+ (event.waitUntil.new.Promise):
+ (setTimeout):
+
2017-11-13 Ryan Haddad <[email protected]>
Adjust TestExpectation for js/intl-datetimeformat.html.
Added: trunk/LayoutTests/http/tests/workers/service/basic-unregister-then-register-again-reuse-expected.txt (0 => 224772)
--- trunk/LayoutTests/http/tests/workers/service/basic-unregister-then-register-again-reuse-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/basic-unregister-then-register-again-reuse-expected.txt 2017-11-13 21:06:23 UTC (rev 224772)
@@ -0,0 +1,5 @@
+PASS: registration1 should not have an installing worker
+PASS: registration1 should not have a waiting worker
+PASS: registration1 should have an active worker
+PASS: Registration was reused
+
Added: trunk/LayoutTests/http/tests/workers/service/basic-unregister-then-register-again-reuse.html (0 => 224772)
--- trunk/LayoutTests/http/tests/workers/service/basic-unregister-then-register-again-reuse.html (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/basic-unregister-then-register-again-reuse.html 2017-11-13 21:06:23 UTC (rev 224772)
@@ -0,0 +1,55 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+
+function waitForMessageEvent()
+{
+ return new Promise(resolve => {
+ navigator.serviceWorker.addEventListener('message', resolve, { once: true });
+ });
+}
+
+async function test()
+{
+ try {
+ let registration1 = await navigator.serviceWorker.register("resources/basic-unregister-then-register-again-reuse-worker.js", { });
+ await waitForState(registration1.installing, "activated");
+ if (registration1.installing)
+ log("FAIL: registration1 should not have an installing worker");
+ else
+ log("PASS: registration1 should not have an installing worker");
+
+ if (registration1.waiting)
+ log("FAIL: registration1 should not have a waiting worker");
+ else
+ log("PASS: registration1 should not have a waiting worker");
+
+ if (registration1.active)
+ log("PASS: registration1 should have an active worker");
+ else
+ log("FAIL: registration1 should have an active worker");
+
+ // Service worker will use waitUntil() on the received ExtendableMessageEvent to extend its lifetime.
+ registration1.active.postMessage("ExtendLifetime");
+
+ await waitForMessageEvent();
+ await registration1.unregister();
+
+ let registration2 = await navigator.serviceWorker.register("resources/basic-unregister-then-register-again-reuse-worker.js", { });
+ if (registration1 === registration2)
+ log("PASS: Registration was reused");
+ else
+ log("FAIL: Registration was not reused");
+ } catch (e) {
+ log("FAIL: Got exception " + e);
+ }
+ finishSWTest();
+}
+
+test();
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/workers/service/resources/basic-unregister-then-register-again-reuse-worker.js (0 => 224772)
--- trunk/LayoutTests/http/tests/workers/service/resources/basic-unregister-then-register-again-reuse-worker.js (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-unregister-then-register-again-reuse-worker.js 2017-11-13 21:06:23 UTC (rev 224772)
@@ -0,0 +1,11 @@
+self.addEventListener("message", function(event) {
+ event.waitUntil(new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve();
+ }, 10000);
+ }));
+ client = event.source;
+ setTimeout(function() {
+ client.postMessage("ExtendedLifetime");
+ }, 0);
+});
Modified: trunk/Source/WebCore/ChangeLog (224771 => 224772)
--- trunk/Source/WebCore/ChangeLog 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/ChangeLog 2017-11-13 21:06:23 UTC (rev 224772)
@@ -1,3 +1,36 @@
+2017-11-13 Chris Dumez <[email protected]>
+
+ Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=179618
+
+ Reviewed by Brady Eidson.
+
+ Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms:
+ - https://w3c.github.io/ServiceWorker/#service-worker-has-no-pending-events-algorithm
+ - https://w3c.github.io/ServiceWorker/#update-service-worker-extended-events-set-algorithm
+
+ Test: http/tests/workers/service/basic-unregister-then-register-again-reuse.html
+
+ * workers/service/context/SWContextManager.h:
+ * workers/service/context/ServiceWorkerFetch.cpp:
+ (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
+ * workers/service/context/ServiceWorkerFetch.h:
+ * workers/service/context/ServiceWorkerThread.cpp:
+ (WebCore::ServiceWorkerThread::postFetchTask):
+ (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
+ (WebCore::ServiceWorkerThread::updateExtendedEventsSet):
+ * workers/service/context/ServiceWorkerThread.h:
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::Connection::setServiceWorkerHasPendingEvents):
+ (WebCore::SWServer::setServiceWorkerHasPendingEvents):
+ * workers/service/server/SWServer.h:
+ * workers/service/server/SWServerJobQueue.cpp:
+ (WebCore::SWServerJobQueue::tryActivate):
+ (WebCore::SWServerJobQueue::tryClearRegistration):
+ * workers/service/server/SWServerWorker.h:
+ (WebCore::SWServerWorker::hasPendingEvents const):
+ (WebCore::SWServerWorker::setHasPendingEvents):
+
2017-11-13 Colin Bendell <[email protected]>
Added mime type check to the picture source preloader to avoid downloading incompatible resources.
Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.h (224771 => 224772)
--- trunk/Source/WebCore/workers/service/context/SWContextManager.h 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h 2017-11-13 21:06:23 UTC (rev 224772)
@@ -49,6 +49,7 @@
virtual void serviceWorkerStartedWithMessage(ServiceWorkerIdentifier, const String& exceptionMessage) = 0;
virtual void didFinishInstall(ServiceWorkerIdentifier, bool wasSuccessful) = 0;
virtual void didFinishActivation(ServiceWorkerIdentifier) = 0;
+ virtual void setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier, bool) = 0;
};
WEBCORE_EXPORT void setConnection(std::unique_ptr<Connection>&&);
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp (224771 => 224772)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp 2017-11-13 21:06:23 UTC (rev 224772)
@@ -85,7 +85,7 @@
client->didFinish();
}
-void dispatchFetchEvent(Ref<Client>&& client, WorkerGlobalScope& globalScope, ResourceRequest&& request, FetchOptions&& options)
+Ref<FetchEvent> dispatchFetchEvent(Ref<Client>&& client, WorkerGlobalScope& globalScope, ResourceRequest&& request, FetchOptions&& options)
{
ASSERT(globalScope.isServiceWorkerGlobalScope());
@@ -108,11 +108,12 @@
if (!event->respondWithEntered()) {
if (event->defaultPrevented()) {
client->didFail();
- return;
+ return event;
}
client->didNotHandle();
// FIXME: Handle soft update.
}
+ return event;
}
} // namespace ServiceWorkerFetch
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.h (224771 => 224772)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.h 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerFetch.h 2017-11-13 21:06:23 UTC (rev 224772)
@@ -31,6 +31,7 @@
#include <wtf/ThreadSafeRefCounted.h>
namespace WebCore {
+class FetchEvent;
struct FetchOptions;
class FetchResponse;
class ResourceRequest;
@@ -50,7 +51,7 @@
virtual void didNotHandle() = 0;
};
-void dispatchFetchEvent(Ref<Client>&&, WorkerGlobalScope&, ResourceRequest&&, FetchOptions&&);
+Ref<FetchEvent> dispatchFetchEvent(Ref<Client>&&, WorkerGlobalScope&, ResourceRequest&&, FetchOptions&&);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (224771 => 224772)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2017-11-13 21:06:23 UTC (rev 224772)
@@ -99,19 +99,22 @@
{
// FIXME: instead of directly using runLoop(), we should be using something like WorkerGlobalScopeProxy.
// FIXME: request and options come straigth from IPC so are already isolated. We should be able to take benefit of that.
- runLoop().postTaskForMode([client = WTFMove(client), request = request.isolatedCopy(), options = options.isolatedCopy()] (ScriptExecutionContext& context) mutable {
- ServiceWorkerFetch::dispatchFetchEvent(WTFMove(client), downcast<WorkerGlobalScope>(context), WTFMove(request), WTFMove(options));
+ runLoop().postTaskForMode([this, client = WTFMove(client), request = request.isolatedCopy(), options = options.isolatedCopy()] (ScriptExecutionContext& context) mutable {
+ auto fetchEvent = ServiceWorkerFetch::dispatchFetchEvent(WTFMove(client), downcast<WorkerGlobalScope>(context), WTFMove(request), WTFMove(options));
+ updateExtendedEventsSet(fetchEvent.ptr());
}, WorkerRunLoop::defaultMode());
}
void ServiceWorkerThread::postMessageToServiceWorkerGlobalScope(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels, const ServiceWorkerClientIdentifier& sourceIdentifier, const String& sourceOrigin)
{
- ScriptExecutionContext::Task task([channels = WTFMove(channels), message = WTFMove(message), sourceIdentifier, sourceOrigin = sourceOrigin.isolatedCopy()] (ScriptExecutionContext& context) mutable {
+ ScriptExecutionContext::Task task([this, channels = WTFMove(channels), message = WTFMove(message), sourceIdentifier, sourceOrigin = sourceOrigin.isolatedCopy()] (ScriptExecutionContext& context) mutable {
auto& serviceWorkerGlobalScope = downcast<ServiceWorkerGlobalScope>(context);
auto ports = MessagePort::entanglePorts(serviceWorkerGlobalScope, WTFMove(channels));
ExtendableMessageEventSource source = RefPtr<ServiceWorkerClient> { ServiceWorkerWindowClient::create(context, sourceIdentifier) };
- serviceWorkerGlobalScope.dispatchEvent(ExtendableMessageEvent::create(WTFMove(ports), WTFMove(message), sourceOrigin, { }, WTFMove(source)));
+ auto messageEvent = ExtendableMessageEvent::create(WTFMove(ports), WTFMove(message), sourceOrigin, { }, WTFMove(source));
+ serviceWorkerGlobalScope.dispatchEvent(messageEvent);
serviceWorkerGlobalScope.thread().workerObjectProxy().confirmMessageFromWorkerObject(serviceWorkerGlobalScope.hasPendingActivity());
+ updateExtendedEventsSet(messageEvent.ptr());
});
runLoop().postTask(WTFMove(task));
}
@@ -157,6 +160,33 @@
runLoop().postTask(WTFMove(task));
}
+// https://w3c.github.io/ServiceWorker/#update-service-worker-extended-events-set-algorithm
+void ServiceWorkerThread::updateExtendedEventsSet(ExtendableEvent* newEvent)
+{
+ ASSERT(!isMainThread());
+ ASSERT(!newEvent || !newEvent->isBeingDispatched());
+ bool hadPendingEvents = hasPendingEvents();
+ m_extendedEvents.removeAllMatching([](auto& event) {
+ return !event->pendingPromiseCount();
+ });
+
+ if (newEvent && newEvent->pendingPromiseCount()) {
+ m_extendedEvents.append(*newEvent);
+ newEvent->whenAllExtendLifetimePromisesAreSettled([this](auto&&) {
+ updateExtendedEventsSet();
+ });
+ }
+
+ bool hasPendingEvents = this->hasPendingEvents();
+ if (hasPendingEvents == hadPendingEvents)
+ return;
+
+ callOnMainThread([identifier = this->identifier(), hasPendingEvents] {
+ if (auto* connection = SWContextManager::singleton().connection())
+ connection->setServiceWorkerHasPendingEvents(identifier, hasPendingEvents);
+ });
+}
+
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h (224771 => 224772)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h 2017-11-13 21:06:23 UTC (rev 224772)
@@ -36,6 +36,7 @@
class CacheStorageProvider;
class ContentSecurityPolicyResponseHeaders;
+class ExtendableEvent;
class MessagePortChannel;
class SerializedScriptValue;
class WorkerObjectProxy;
@@ -71,9 +72,13 @@
private:
WEBCORE_EXPORT ServiceWorkerThread(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData&, PAL::SessionID, WorkerLoaderProxy&, WorkerDebuggerProxy&);
+ void updateExtendedEventsSet(ExtendableEvent* newEvent = nullptr);
+ bool hasPendingEvents() const { return !m_extendedEvents.isEmpty(); }
+
uint64_t m_serverConnectionIdentifier;
ServiceWorkerContextData m_data;
WorkerObjectProxy& m_workerObjectProxy;
+ Vector<Ref<ExtendableEvent>> m_extendedEvents;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (224771 => 224772)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2017-11-13 21:06:23 UTC (rev 224772)
@@ -122,6 +122,11 @@
m_server.didFinishActivation(*this, key, serviceWorkerIdentifier);
}
+void SWServer::Connection::setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier serviceWorkerIdentifier, bool hasPendingEvents)
+{
+ m_server.setServiceWorkerHasPendingEvents(*this, serviceWorkerIdentifier, hasPendingEvents);
+}
+
void SWServer::Connection::didResolveRegistrationPromise(const ServiceWorkerRegistrationKey& key)
{
m_server.didResolveRegistrationPromise(*this, key);
@@ -255,6 +260,14 @@
SWServerJobQueue::didFinishActivation(*registration, serviceWorkerIdentifier);
}
+void SWServer::setServiceWorkerHasPendingEvents(Connection& connection, ServiceWorkerIdentifier serviceWorkerIdentifier, bool hasPendingEvents)
+{
+ ASSERT_UNUSED(connection, m_connections.contains(connection.identifier()));
+
+ if (auto* serviceWorker = m_workersByID.get(serviceWorkerIdentifier))
+ serviceWorker->setHasPendingEvents(hasPendingEvents);
+}
+
void SWServer::didResolveRegistrationPromise(Connection& connection, const ServiceWorkerRegistrationKey& registrationKey)
{
ASSERT(m_connections.contains(connection.identifier()));
Modified: trunk/Source/WebCore/workers/service/server/SWServer.h (224771 => 224772)
--- trunk/Source/WebCore/workers/service/server/SWServer.h 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/server/SWServer.h 2017-11-13 21:06:23 UTC (rev 224772)
@@ -63,6 +63,7 @@
WEBCORE_EXPORT void scriptContextStarted(const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier);
WEBCORE_EXPORT void didFinishInstall(const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier, bool wasSuccessful);
WEBCORE_EXPORT void didFinishActivation(const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier);
+ WEBCORE_EXPORT void setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier, bool hasPendingEvents);
WEBCORE_EXPORT void didResolveRegistrationPromise(const ServiceWorkerRegistrationKey&);
const SWServerRegistration* doRegistrationMatching(const SecurityOriginData& topOrigin, const URL& clientURL) const { return m_server.doRegistrationMatching(topOrigin, clientURL); }
@@ -132,6 +133,7 @@
void scriptContextStarted(Connection&, const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier);
void didFinishInstall(Connection&, const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier, bool wasSuccessful);
void didFinishActivation(Connection&, const ServiceWorkerRegistrationKey&, ServiceWorkerIdentifier);
+ void setServiceWorkerHasPendingEvents(Connection&, ServiceWorkerIdentifier, bool hasPendingEvents);
void didResolveRegistrationPromise(Connection&, const ServiceWorkerRegistrationKey&);
void addClientServiceWorkerRegistration(Connection&, const ServiceWorkerRegistrationKey&, ServiceWorkerRegistrationIdentifier);
Modified: trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp (224771 => 224772)
--- trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2017-11-13 21:06:23 UTC (rev 224772)
@@ -189,12 +189,13 @@
if (registration.activeWorker() && registration.activeWorker()->state() == ServiceWorkerState::Activating)
return;
- // FIXME: Invoke Activate with registration if either of the following is true:
+ // Invoke Activate with registration if either of the following is true:
// - registration's active worker is null.
// - The result of running Service Worker Has No Pending Events with registration's active worker is true,
- // and no service worker client is using registration or registration's waiting worker's skip waiting
- // flag is set.
- activate(server, connection, registration);
+ // and no service worker client is using registration
+ // FIXME: Check for the skip waiting flag.
+ if (!registration.activeWorker() || !registration.activeWorker()->hasPendingEvents())
+ activate(server, connection, registration);
}
// https://w3c.github.io/ServiceWorker/#activate
@@ -328,8 +329,13 @@
{
// FIXME: Make sure that the registration has no service worker client.
- // FIXME: The specification has more complex logic here. We currently clear registrations
- // too aggressively.
+ if (registration.installingWorker() && registration.installingWorker()->hasPendingEvents())
+ return;
+ if (registration.waitingWorker() && registration.waitingWorker()->hasPendingEvents())
+ return;
+ if (registration.activeWorker() && registration.activeWorker()->hasPendingEvents())
+ return;
+
clearRegistration(registration);
}
Modified: trunk/Source/WebCore/workers/service/server/SWServerWorker.h (224771 => 224772)
--- trunk/Source/WebCore/workers/service/server/SWServerWorker.h 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebCore/workers/service/server/SWServerWorker.h 2017-11-13 21:06:23 UTC (rev 224772)
@@ -58,6 +58,9 @@
ServiceWorkerState state() const { return m_state; }
void setState(ServiceWorkerState state) { m_state = state; }
+ bool hasPendingEvents() const { return m_hasPendingEvents; }
+ void setHasPendingEvents(bool value) { m_hasPendingEvents = value; }
+
private:
SWServerWorker(const ServiceWorkerRegistrationKey&, const URL&, const String& script, WorkerType, ServiceWorkerIdentifier);
@@ -68,6 +71,7 @@
WorkerType m_type;
ServiceWorkerState m_state { ServiceWorkerState::Redundant };
+ bool m_hasPendingEvents { false };
};
} // namespace WebCore
Modified: trunk/Source/WebKit/ChangeLog (224771 => 224772)
--- trunk/Source/WebKit/ChangeLog 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebKit/ChangeLog 2017-11-13 21:06:23 UTC (rev 224772)
@@ -1,3 +1,18 @@
+2017-11-13 Chris Dumez <[email protected]>
+
+ Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms
+ https://bugs.webkit.org/show_bug.cgi?id=179618
+
+ Reviewed by Brady Eidson.
+
+ * StorageProcess/StorageProcess.cpp:
+ (WebKit::StorageProcess::setServiceWorkerHasPendingEvents):
+ * StorageProcess/StorageProcess.h:
+ * StorageProcess/StorageProcess.messages.in:
+ * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+ (WebKit::WebSWContextManagerConnection::setServiceWorkerHasPendingEvents):
+ * WebProcess/Storage/WebSWContextManagerConnection.h:
+
2017-11-13 Wenson Hsieh <[email protected]>
[Attachment Support] Implement SPI for clients to request data for a given attachment
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (224771 => 224772)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2017-11-13 21:06:23 UTC (rev 224772)
@@ -465,6 +465,13 @@
connection->didFinishActivation(registrationKey, serviceWorkerIdentifier);
}
+
+void StorageProcess::setServiceWorkerHasPendingEvents(uint64_t serverConnectionIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool hasPendingEvents)
+{
+ if (auto* connection = m_swServerConnections.get(serverConnectionIdentifier))
+ connection->setServiceWorkerHasPendingEvents(serviceWorkerIdentifier, hasPendingEvents);
+}
+
void StorageProcess::registerSWServerConnection(WebSWServerConnection& connection)
{
ASSERT(!m_swServerConnections.contains(connection.identifier()));
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (224771 => 224772)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h 2017-11-13 21:06:23 UTC (rev 224772)
@@ -130,6 +130,7 @@
void didFinishServiceWorkerInstall(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, WebCore::ServiceWorkerIdentifier, bool wasSuccessful);
void didFinishServiceWorkerActivation(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerRegistrationKey&, WebCore::ServiceWorkerIdentifier);
+ void setServiceWorkerHasPendingEvents(uint64_t serverConnectionIdentifier, WebCore::ServiceWorkerIdentifier, bool hasPendingEvents);
void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin);
#endif
#if ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in (224771 => 224772)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.messages.in 2017-11-13 21:06:23 UTC (rev 224772)
@@ -42,6 +42,7 @@
ServiceWorkerContextStarted(uint64_t serverConnectionIdentifier, WebCore::ServiceWorkerRegistrationKey registrationKey, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier)
DidFinishServiceWorkerInstall(uint64_t serverConnectionIdentifier, WebCore::ServiceWorkerRegistrationKey registrationKey, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful);
DidFinishServiceWorkerActivation(uint64_t serverConnectionIdentifier, WebCore::ServiceWorkerRegistrationKey registrationKey, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier);
+ SetServiceWorkerHasPendingEvents(uint64_t serverConnectionIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool hasPendingEvents);
DidNotHandleFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
DidFailFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (224771 => 224772)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp 2017-11-13 21:06:23 UTC (rev 224772)
@@ -184,6 +184,14 @@
m_connectionToStorageProcess->send(Messages::StorageProcess::DidFinishServiceWorkerActivation(threadProxy->thread().serverConnectionIdentifier(), data.registrationKey, serviceWorkerIdentifier), 0);
}
+void WebSWContextManagerConnection::setServiceWorkerHasPendingEvents(ServiceWorkerIdentifier serviceWorkerIdentifier, bool hasPendingEvents)
+{
+ auto* threadProxy = SWContextManager::singleton().serviceWorkerThreadProxy(serviceWorkerIdentifier);
+ ASSERT(threadProxy);
+
+ m_connectionToStorageProcess->send(Messages::StorageProcess::SetServiceWorkerHasPendingEvents(threadProxy->thread().serverConnectionIdentifier(), serviceWorkerIdentifier, hasPendingEvents), 0);
+}
+
} // namespace WebCore
#endif // ENABLE(SERVICE_WORKER)
Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (224771 => 224772)
--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-11-13 21:02:58 UTC (rev 224771)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h 2017-11-13 21:06:23 UTC (rev 224772)
@@ -54,6 +54,7 @@
void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, Ref<WebCore::SerializedScriptValue>&& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin) final;
void didFinishInstall(WebCore::ServiceWorkerIdentifier, bool wasSuccessful) final;
void didFinishActivation(WebCore::ServiceWorkerIdentifier) final;
+ void setServiceWorkerHasPendingEvents(WebCore::ServiceWorkerIdentifier, bool) final;
// IPC messages.
void serviceWorkerStartedWithMessage(WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final;