Start exposing self.registration inside service workers
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 22:19:23 +0000 (22:19 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 22:19:23 +0000 (22:19 +0000)
commit4a39454e9c125d61b3abce6d7c8c7e95d381151d
tree765ad57627544a1d6b1c14e8a635b54dc16bbdef
parent8bbcee2a7d2a1f02cef5d93697690d06e8dd4ad3
Start exposing self.registration inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180162

Reviewed by Brady Eidson.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/redirected-response.https-expected.txt:

Source/WebCore:

Start exposing self.registration inside service workers as per:
- https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface

This is very initial support:
- The operations on the registration (such as update) will reject the promise for now.
- The registration's service workers are not yet populated.

This will be implemented in a follow-up.

Tests: http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject.html
       http/tests/workers/service/self_registration.html

* bindings/js/JSServiceWorkerGlobalScopeCustom.cpp:
(WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::addRegistration):
* workers/service/ServiceWorkerContextData.cpp:
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):
* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
* workers/service/ServiceWorkerGlobalScope.h:
(WebCore::ServiceWorkerGlobalScope::registration):
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::installContextData):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):

LayoutTests:

Add layout test coverage.

* TestExpectations:
Skip test that covers self.registration.update() because it now times out. We do not support update()
on registrations inside service workers yet so the test times out waiting for the updatefound event
on the registration.

* http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject-expected.txt: Added.
* http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject.html: Added.
* http/tests/workers/service/resources/ServiceWorkerGlobalScope_registration_SameObject-worker.js: Added.
* http/tests/workers/service/resources/self_registration-worker.js: Added.
* http/tests/workers/service/self_registration-expected.txt: Added.
* http/tests/workers/service/self_registration.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/ServiceWorkerGlobalScope_registration_SameObject-worker.js [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/self_registration-worker.js [new file with mode: 0644]
LayoutTests/http/tests/workers/service/self_registration-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/self_registration.html [new file with mode: 0644]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https-expected.txt
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/navigation-redirect.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/redirected-response.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSServiceWorkerGlobalScopeCustom.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContextData.cpp
Source/WebCore/workers/service/ServiceWorkerContextData.h
Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp
Source/WebCore/workers/service/ServiceWorkerGlobalScope.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerJobQueue.cpp