Implement self.skipWaiting() inside service workers
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Dec 2017 20:32:57 +0000 (20:32 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Dec 2017 20:32:57 +0000 (20:32 +0000)
commit94316eb3131e6e23edb4e139fef145b00c0e3034
tree43a7a224ccc6c33dcd3811784f56f93c833c59c2
parent4d20ac28a5bec2f27f7921bff08f69d436c61bee
Implement self.skipWaiting() inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180329

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT tests that are now passing.

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https-expected.txt:
* web-platform-tests/service-workers/service-worker/claim-with-redirect.https-expected.txt:
* web-platform-tests/service-workers/service-worker/postmessage-from-waiting-serviceworker.https-expected.txt:
* web-platform-tests/service-workers/service-worker/skip-waiting-without-client.https-expected.txt:

Source/WebCore:

Implement self.skipWaiting() inside service workers:
- https://w3c.github.io/ServiceWorker/#service-worker-global-scope-skipwaiting

Also fixes a bug where tryActivate() was calling activate() even though the
registration's active worker was "in use":
- https://w3c.github.io/ServiceWorker/#try-activate-algorithm

No new tests, rebaselined existing tests.

* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::skipWaiting):
* workers/service/context/SWContextManager.h:
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::tryActivate):
* workers/service/server/SWServerToContextConnection.cpp:
(WebCore::SWServerToContextConnection::skipWaiting):
* workers/service/server/SWServerToContextConnection.h:
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::skipWaiting):
* workers/service/server/SWServerWorker.h:
(WebCore::SWServerWorker::isSkipWaitingFlagSet const):

Source/WebKit:

* StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::didFinishSkipWaiting):
* StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
* StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::skipWaiting):
(WebKit::WebSWContextManagerConnection::didFinishSkipWaiting):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:

LayoutTests:

* http/tests/workers/service/resources/service-worker-fetch-worker.js:
add self.skipWaiting() now that we properly wait when the registation's
active worker is in use. This is needed because this worker script is
used by http/tests/workers/service/controller-change.html. The
'controllerchange' event is only fired if an active worker is being
replaced while in use due to the waiting worker calling skipWaiting().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/resources/service-worker-fetch-worker.js
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/postmessage-from-waiting-serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting-without-client.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp
Source/WebCore/workers/service/context/SWContextManager.h
Source/WebCore/workers/service/server/SWServerRegistration.cpp
Source/WebCore/workers/service/server/SWServerToContextConnection.cpp
Source/WebCore/workers/service/server/SWServerToContextConnection.h
Source/WebCore/workers/service/server/SWServerWorker.cpp
Source/WebCore/workers/service/server/SWServerWorker.h
Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.h
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerToContextConnection.messages.in
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in