Start exposing navigator.serviceWorker inside service workers
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Nov 2017 18:22:20 +0000 (18:22 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Nov 2017 18:22:20 +0000 (18:22 +0000)
commit23fb63d8545c92ac0891a2b7d8e4cbf3cb3df0d5
tree08f8bb9f39a9beb9d367a5a4365d16b812eaec8d
parent87acd9fa7dbc2ca1b205e858a44a3419efd2ec05
Start exposing navigator.serviceWorker inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180087

Reviewed by Brady Eidson.

Source/WebCore:

Start exposing navigator.serviceWorker inside service workers as per:
- https://w3c.github.io/ServiceWorker/#navigator-serviceworker

Although the property is now exposed, the API on ServiceWorkerContainer is not
supported yet inside service workers and the promise will be rejected. This will
be implemented in a follow-up.

Test: http/tests/workers/service/WorkerNavigator_serviceWorker.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSWorkerNavigatorCustom.cpp: Added.
(WebCore::JSWorkerNavigator::visitAdditionalChildren):
* page/WorkerNavigator.idl:
* workers/service/ServiceWorker.idl:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::controller const):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::getRegistration):
(WebCore::ServiceWorkerContainer::getRegistrations):
* workers/service/ServiceWorkerContainer.idl:
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::update):
(WebCore::ServiceWorkerRegistration::unregister):
* workers/service/ServiceWorkerRegistration.idl:

LayoutTests:

Add layout test coverage.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/WorkerNavigator_serviceWorker-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/WorkerNavigator_serviceWorker.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/WorkerNavigator_serviceWorker-worker.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSWorkerNavigatorCustom.cpp [new file with mode: 0644]
Source/WebCore/page/WorkerNavigator.idl
Source/WebCore/workers/service/ServiceWorker.idl
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.idl
Source/WebCore/workers/service/ServiceWorkerRegistration.cpp
Source/WebCore/workers/service/ServiceWorkerRegistration.idl