Implement most of ServiceWorkerContainer::addRegistration.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Aug 2017 18:22:05 +0000 (18:22 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Aug 2017 18:22:05 +0000 (18:22 +0000)
commit77972daf8843f8ee5e9194faca8288317dc5af64
treed6d9bf669d71231c75a4c2cc2d97b80a1286a0a5
parente1dc6f7431693a2d3323d11e9c26df2bd85179d6
Implement most of ServiceWorkerContainer::addRegistration.
https://bugs.webkit.org/show_bug.cgi?id=175237

Reviewed by Andy Estes.

LayoutTests/imported/w3c:

* web-platform-tests/FileAPI/historical.https-expected.txt:
* web-platform-tests/background-fetch/interfaces-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt:
* web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https-expected.txt:
* web-platform-tests/html/webappapis/scripting/events/messageevent-constructor.https-expected.txt:
* web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-add.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-delete.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-keys.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-matchAll.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-put.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-keys.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-match.https-expected.txt:
* web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage.https-expected.txt:
* web-platform-tests/streams/byte-length-queuing-strategy.serviceworker.https-expected.txt:
* web-platform-tests/streams/count-queuing-strategy.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/close-propagation-backward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/close-propagation-forward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/error-propagation-backward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/error-propagation-forward.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/flow-control.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/general.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/multiple-propagation.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/pipe-through.serviceworker.https-expected.txt:
* web-platform-tests/streams/piping/transform-streams.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-byte-streams/general.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/bad-strategies.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/bad-underlying-sources.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/brand-checks.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/cancel.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/default-reader.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/floating-point-total-queue-size.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/garbage-collection.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/general.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/pipe-through.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/readable-stream-reader.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/tee.serviceworker.https-expected.txt:
* web-platform-tests/streams/readable-streams/templated.serviceworker.https-expected.txt:

Source/WebCore:

No new tests (Covered by changes to existing tests).

There's still so much supporting infrastructure to add with these early patches
that I'm still moving them in baby steps for now, hence not implementing
register() all in one shot.

Things will start moving very quickly once we no longer need to add lots of new
primitives in each change.

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:

* page/DOMWindow.cpp:
(WebCore::DOMWindow::navigator const):

* page/Navigator.cpp:
(WebCore::Navigator::Navigator): Make the constructor take a ScriptExecutionContext for
  creation of objects where its import (e.g. ServiceWorkerContainer).
* page/Navigator.h:

* page/WorkerNavigator.cpp:
(WebCore::WorkerNavigator::WorkerNavigator): Ditto.
* page/WorkerNavigator.h:

* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::NavigatorBase): Create the ServiceWorkerContainer upfront with
  the passed-in ScriptExecutionContext.
(WebCore::NavigatorBase::serviceWorker):
* page/NavigatorBase.h:

Make ServiceWorkerContainer into an ActiveDOMObject. This will eventually be necessary for
Document suspension reasons, but is also necessary because it also needs to be a
ContextDestructionObserver (which ActiveDOMObject is):
* workers/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::ready):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::getRegistration):
(WebCore::ServiceWorkerContainer::getRegistrations):
(WebCore::ServiceWorkerContainer::activeDOMObjectName const):
(WebCore::ServiceWorkerContainer::canSuspendForDocumentSuspension const):
(WebCore::rejectLater): Deleted.
(WebCore::ServiceWorkerContainer::eventTargetInterface const): Deleted.
(WebCore::ServiceWorkerContainer::scriptExecutionContext const): Deleted.
* workers/ServiceWorkerContainer.h:
* workers/ServiceWorkerContainer.idl:

Add updateViaCache, etc:
* workers/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::updateViaCache const):
(WebCore::ServiceWorkerRegistration::update):
(WebCore::ServiceWorkerRegistration::unregister):
* workers/ServiceWorkerRegistration.h:
* workers/ServiceWorkerRegistration.idl:

* workers/ServiceWorkerUpdateViaCache.h: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
* workers/ServiceWorkerUpdateViaCache.idl: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.

* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::navigator):
(WebCore::WorkerGlobalScope::navigator const): Deleted.
* workers/WorkerGlobalScope.h:

* workers/WorkerType.h: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
* workers/WorkerType.idl: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
66 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/background-fetch/interfaces-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/messageevent-constructor.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-add.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-delete.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-keys.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-matchAll.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-put.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-keys.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage-match.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-storage.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/byte-length-queuing-strategy.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/count-queuing-strategy.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-backward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-forward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-forward.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/flow-control.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/general.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/multiple-propagation.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/pipe-through.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/piping/transform-streams.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-strategies.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/brand-checks.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/cancel.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/default-reader.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/floating-point-total-queue-size.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/garbage-collection.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/pipe-through.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/readable-stream-reader.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.serviceworker.https-expected.txt
LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/templated.serviceworker.https-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/Navigator.cpp
Source/WebCore/page/Navigator.h
Source/WebCore/page/NavigatorBase.cpp
Source/WebCore/page/NavigatorBase.h
Source/WebCore/page/WorkerNavigator.cpp
Source/WebCore/page/WorkerNavigator.h
Source/WebCore/workers/ServiceWorkerContainer.cpp
Source/WebCore/workers/ServiceWorkerContainer.h
Source/WebCore/workers/ServiceWorkerContainer.idl
Source/WebCore/workers/ServiceWorkerRegistration.cpp
Source/WebCore/workers/ServiceWorkerRegistration.h
Source/WebCore/workers/ServiceWorkerRegistration.idl
Source/WebCore/workers/ServiceWorkerUpdateViaCache.h [new file with mode: 0644]
Source/WebCore/workers/ServiceWorkerUpdateViaCache.idl [new file with mode: 0644]
Source/WebCore/workers/WorkerGlobalScope.cpp
Source/WebCore/workers/WorkerGlobalScope.h
Source/WebCore/workers/WorkerType.h [new file with mode: 0644]
Source/WebCore/workers/WorkerType.idl [new file with mode: 0644]