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)
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]

index 2caeb1e..89ae2c6 100644 (file)
@@ -1,3 +1,53 @@
+2017-08-07  Brady Eidson  <beidson@apple.com>
+
+        Implement most of ServiceWorkerContainer::addRegistration.
+        https://bugs.webkit.org/show_bug.cgi?id=175237
+
+        Reviewed by Andy Estes.
+
+        * 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:
+
 2017-08-05  Youenn Fablet  <youenn@apple.com>
 
         [Cache API] Add Cache and CacheStorage IDL definitions
index 6537c2b..11d39bc 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
 PASS "toNativeLineEndings" should not be supported 
 FAIL "FileError" should not be supported assert_false: expected false got true
@@ -6,5 +7,5 @@ PASS Blob should not support slice prefixed
 PASS BlobBuilder should not be supported. 
 PASS createFor method should not be supported 
 PASS Blob.close() should not be supported 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 7b0f935..bfab5c4 100644 (file)
@@ -1,7 +1,8 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 idlharness test
 
 This test validates the WebIDL included in the Background Fetch API (Service Workers).
 
 
-FAIL Service Worker-scoped tests. assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service Worker-scoped tests. assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index ba2a538..d94babb 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Fetch in service worker: referrer with no-referrer policy assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Fetch in service worker: referrer with no-referrer policy assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index ba2a538..d94babb 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Fetch in service worker: referrer with no-referrer policy assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Fetch in service worker: referrer with no-referrer policy assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index cce1069..9dfbb83 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Fetch in service worker: referrer with origin-when-cross-origin policy assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Fetch in service worker: referrer with origin-when-cross-origin policy assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index c0dec53..09ecca0 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Fetch in worker: referrer with unsafe-url policy assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Fetch in worker: referrer with unsafe-url policy assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index d223117..11fce84 100644 (file)
@@ -6,5 +6,5 @@ FAIL ports attribute should be a FrozenArray assert_true: ev.ports should return
 PASS initMessageEvent operation 
 PASS Passing null for ports parameter to initMessageEvent 
 PASS initMessageEvent operation default parameter values 
-FAIL Passing ServiceWorker for source member assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Passing ServiceWorker for source member assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 01d5418..ba001e8 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Cache.add and Cache.addAll assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Cache.add and Cache.addAll assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index c73be01..6b1ffb4 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Cache.delete assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Cache.delete assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 69ebb94..26a2bd9 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Cache.keys assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Cache.keys assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 62e8394..c5b1fbf 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Cache.match assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Cache.match assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index bbde54c..4987972 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Cache.matchAll assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Cache.matchAll assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index dbd1c68..16e0b24 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Cache.put assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Cache.put assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3c7ccfe..b46f9b5 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL CacheStorage.keys assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL CacheStorage.keys assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 605eba8..99d5cbf 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL CacheStorage.match assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL CacheStorage.match assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 870437d..60efebd 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL CacheStorage assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL CacheStorage assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index 3923997..cd5234e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 153: TypeError: undefined is not an object (evaluating 'registration.unregister')
 
-FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
+FAIL Service worker test setup assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code
 
index a1a5ea6..1377602 100644 (file)
@@ -712,9 +712,11 @@ set(WebCore_NON_SVG_IDL_FILES
     workers/ServiceWorkerContainer.idl
     workers/ServiceWorkerGlobalScope.idl
     workers/ServiceWorkerRegistration.idl
+    workers/ServiceWorkerUpdateViaCache.idl
     workers/Worker.idl
     workers/WorkerGlobalScope.idl
     workers/WorkerLocation.idl
+    workers/WorkerType.idl
 
     xml/DOMParser.idl
     xml/XMLHttpRequest.idl
index ebd39db..0ed2b32 100644 (file)
@@ -1,3 +1,77 @@
+2017-08-07  Brady Eidson  <beidson@apple.com>
+
+        Implement most of ServiceWorkerContainer::addRegistration.
+        https://bugs.webkit.org/show_bug.cgi?id=175237
+
+        Reviewed by Andy Estes.
+
+        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.
+
 2017-08-07  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r220299.
index ce5684a..8d564e6 100644 (file)
@@ -838,9 +838,11 @@ JS_BINDING_IDLS = \
     $(WebCore)/workers/ServiceWorkerContainer.idl \
     $(WebCore)/workers/ServiceWorkerGlobalScope.idl \
     $(WebCore)/workers/ServiceWorkerRegistration.idl \
+    $(WebCore)/workers/ServiceWorkerUpdateViaCache.idl \
     $(WebCore)/workers/Worker.idl \
     $(WebCore)/workers/WorkerGlobalScope.idl \
     $(WebCore)/workers/WorkerLocation.idl \
+    $(WebCore)/workers/WorkerType.idl \
     $(WebCore)/xml/DOMParser.idl \
     $(WebCore)/xml/XMLHttpRequest.idl \
     $(WebCore)/xml/XMLHttpRequestEventTarget.idl \
index ecc6556..fd55fd5 100644 (file)
                51EE7B3A1AA5123100F92B21 /* ResourceLoadInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EE7B391AA5123100F92B21 /* ResourceLoadInfo.cpp */; };
                51EEAA731BEFFAB100218008 /* IndexValueEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EEAA711BEFFA7900218008 /* IndexValueEntry.cpp */; };
                51EEAA741BEFFAB100218008 /* IndexValueEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EEAA721BEFFA7900218008 /* IndexValueEntry.h */; };
+               51F174FE1F35899200C74950 /* WorkerType.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F174FC1F35898800C74950 /* WorkerType.h */; };
+               51F174FF1F35899700C74950 /* ServiceWorkerUpdateViaCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F174FD1F35898800C74950 /* ServiceWorkerUpdateViaCache.h */; };
+               51F175021F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F175001F358B3600C74950 /* JSServiceWorkerUpdateViaCache.cpp */; };
+               51F175031F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F175011F358B3600C74950 /* JSServiceWorkerUpdateViaCache.h */; };
+               51F175061F358BF700C74950 /* JSWorkerType.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F175051F358BDE00C74950 /* JSWorkerType.h */; };
+               51F175071F358BF900C74950 /* JSWorkerType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F175041F358BDE00C74950 /* JSWorkerType.cpp */; };
                51F798EF1BE880E7008AE491 /* IDBIndexInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F798EB1BE880D3008AE491 /* IDBIndexInfo.cpp */; };
                51F798F01BE880E7008AE491 /* IDBIndexInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F798EC1BE880D3008AE491 /* IDBIndexInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
                51F886BD1F326A9800C193EF /* JSServiceWorkerContainerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F886BB1F326A9200C193EF /* JSServiceWorkerContainerCustom.cpp */; };
                51EE7B391AA5123100F92B21 /* ResourceLoadInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadInfo.cpp; sourceTree = "<group>"; };
                51EEAA711BEFFA7900218008 /* IndexValueEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexValueEntry.cpp; sourceTree = "<group>"; };
                51EEAA721BEFFA7900218008 /* IndexValueEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexValueEntry.h; sourceTree = "<group>"; };
+               51F174FA1F3588D700C74950 /* WorkerType.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WorkerType.idl; sourceTree = "<group>"; };
+               51F174FB1F3588D700C74950 /* ServiceWorkerUpdateViaCache.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ServiceWorkerUpdateViaCache.idl; sourceTree = "<group>"; };
+               51F174FC1F35898800C74950 /* WorkerType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerType.h; sourceTree = "<group>"; };
+               51F174FD1F35898800C74950 /* ServiceWorkerUpdateViaCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerUpdateViaCache.h; sourceTree = "<group>"; };
+               51F175001F358B3600C74950 /* JSServiceWorkerUpdateViaCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSServiceWorkerUpdateViaCache.cpp; path = WebCore/JSServiceWorkerUpdateViaCache.cpp; sourceTree = "<group>"; };
+               51F175011F358B3600C74950 /* JSServiceWorkerUpdateViaCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSServiceWorkerUpdateViaCache.h; path = WebCore/JSServiceWorkerUpdateViaCache.h; sourceTree = "<group>"; };
+               51F175041F358BDE00C74950 /* JSWorkerType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerType.cpp; sourceTree = "<group>"; };
+               51F175051F358BDE00C74950 /* JSWorkerType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerType.h; sourceTree = "<group>"; };
                51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCanvasElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLCanvasElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                51F798EB1BE880D3008AE491 /* IDBIndexInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexInfo.cpp; sourceTree = "<group>"; };
                                5182C2341F3139FC0059BA7C /* ServiceWorkerRegistration.cpp */,
                                5182C2371F3139FC0059BA7C /* ServiceWorkerRegistration.h */,
                                5182C2321F3139FC0059BA7C /* ServiceWorkerRegistration.idl */,
+                               51F174FD1F35898800C74950 /* ServiceWorkerUpdateViaCache.h */,
+                               51F174FB1F3588D700C74950 /* ServiceWorkerUpdateViaCache.idl */,
                                2E4346330F546A8200B0F1BA /* Worker.cpp */,
                                2E4346340F546A8200B0F1BA /* Worker.h */,
                                2E4346350F546A8200B0F1BA /* Worker.idl */,
                                2EA768030FE7126400AB9C8A /* WorkerScriptLoaderClient.h */,
                                2E4346420F546A8200B0F1BA /* WorkerThread.cpp */,
                                2E4346430F546A8200B0F1BA /* WorkerThread.h */,
+                               51F174FC1F35898800C74950 /* WorkerType.h */,
+                               51F174FA1F3588D700C74950 /* WorkerType.idl */,
                        );
                        path = workers;
                        sourceTree = "<group>";
                                5182C2521F3142500059BA7C /* JSServiceWorker.h */,
                                5182C2511F3142500059BA7C /* JSServiceWorkerContainer.cpp */,
                                5182C2541F3142500059BA7C /* JSServiceWorkerContainer.h */,
+                               51F175001F358B3600C74950 /* JSServiceWorkerUpdateViaCache.cpp */,
+                               51F175011F358B3600C74950 /* JSServiceWorkerUpdateViaCache.h */,
                                5182C24E1F3142500059BA7C /* JSServiceWorkerGlobalScope.cpp */,
                                5182C24D1F3142500059BA7C /* JSServiceWorkerGlobalScope.h */,
                                5182C24F1F3142500059BA7C /* JSServiceWorkerRegistration.cpp */,
                                E1C362ED0EAF2AA9007410BC /* JSWorkerLocation.h */,
                                E1271A570EEECDE400F61213 /* JSWorkerNavigator.cpp */,
                                E1271A560EEECDE400F61213 /* JSWorkerNavigator.h */,
+                               51F175041F358BDE00C74950 /* JSWorkerType.cpp */,
+                               51F175051F358BDE00C74950 /* JSWorkerType.h */,
                        );
                        name = Threads;
                        sourceTree = "<group>";
                                316BDBF71E762AD500DE0D5A /* GPUDepthStencilDescriptor.h in Headers */,
                                316BDBF01E76292000DE0D5A /* GPUDepthStencilState.h in Headers */,
                                316BDB861E6E0A2700DE0D5A /* GPUDevice.h in Headers */,
+                               51F174FE1F35899200C74950 /* WorkerType.h in Headers */,
                                316BDBCD1E75F18400DE0D5A /* GPUDrawable.h in Headers */,
                                316BDBFB1E762D0400DE0D5A /* GPUEnums.h in Headers */,
                                316BDB951E70C89700DE0D5A /* GPUFunction.h in Headers */,
                                A871D45C0A127CBC00B12A68 /* HTMLEmbedElement.h in Headers */,
                                977B386A122883E900B81FF8 /* HTMLEntityParser.h in Headers */,
                                977B386C122883E900B81FF8 /* HTMLEntitySearch.h in Headers */,
+                               51F174FF1F35899700C74950 /* ServiceWorkerUpdateViaCache.h in Headers */,
                                977B386D122883E900B81FF8 /* HTMLEntityTable.h in Headers */,
                                A81369D4097374F600D74463 /* HTMLFieldSetElement.h in Headers */,
                                A8CFF7A60A156978000A4234 /* HTMLFontElement.h in Headers */,
                                6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */,
                                6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */,
                                BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */,
+                               51F175061F358BF700C74950 /* JSWorkerType.h in Headers */,
                                6E3FAD3914733F4011E42307 /* JSWebGLDebugRendererInfo.h in Headers */,
                                6E3FAD3914733F4022E42307 /* JSWebGLDebugShaders.h in Headers */,
                                6E3FAD3914733F4000E42307 /* JSWebGLDepthTexture.h in Headers */,
                                413E00791DB0E4F2002341D2 /* MemoryRelease.h in Headers */,
                                93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */,
                                E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */,
+                               51F175031F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.h in Headers */,
                                75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */,
                                E1ADECBF0E76ACF1004A1A5E /* MessagePort.h in Headers */,
                                41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */,
                                12A253E01C8FFF6600C22295 /* JSKeyframeEffect.cpp in Sources */,
                                935F45420F7C3B5F00D7C1FB /* JSLazyEventListener.cpp in Sources */,
                                BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */,
+                               51F175071F358BF900C74950 /* JSWorkerType.cpp in Sources */,
                                BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */,
                                93A8061F1E03B585008A1F26 /* JSLongRange.cpp in Sources */,
                                8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */,
                                7AF9B20218CFB2DF00C64BEF /* VTTRegion.cpp in Sources */,
                                7AF9B20518CFB2DF00C64BEF /* VTTRegionList.cpp in Sources */,
                                7A93868518DCC14500B8263D /* VTTScanner.cpp in Sources */,
+                               51F175021F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.cpp in Sources */,
                                A14832B1187F61E100DA63A6 /* WAKAppKitStubs.m in Sources */,
                                A14832B3187F629100DA63A6 /* WAKClipView.m in Sources */,
                                A14832B5187F62FC00DA63A6 /* WAKResponder.m in Sources */,
index 3e4ad11..b50beab 100644 (file)
@@ -786,8 +786,12 @@ Navigator* DOMWindow::navigator() const
 {
     if (!isCurrentlyDisplayedInFrame())
         return nullptr;
-    if (!m_navigator)
-        m_navigator = Navigator::create(*m_frame);
+
+    if (!m_navigator) {
+        ASSERT(scriptExecutionContext());
+        m_navigator = Navigator::create(*scriptExecutionContext(), *m_frame);
+    }
+
     return m_navigator.get();
 }
 
index ff60fca..b6d558f 100644 (file)
@@ -43,8 +43,9 @@ using namespace WTF;
 
 namespace WebCore {
 
-Navigator::Navigator(Frame& frame)
-    : DOMWindowProperty(&frame)
+Navigator::Navigator(ScriptExecutionContext& context, Frame& frame)
+    : NavigatorBase(context)
+    , DOMWindowProperty(&frame)
 {
 }
 
index 78d9e06..7427524 100644 (file)
@@ -31,7 +31,7 @@ class DOMPluginArray;
 
 class Navigator final : public NavigatorBase, public ScriptWrappable, public DOMWindowProperty, public Supplementable<Navigator> {
 public:
-    static Ref<Navigator> create(Frame& frame) { return adoptRef(*new Navigator(frame)); }
+    static Ref<Navigator> create(ScriptExecutionContext& context, Frame& frame) { return adoptRef(*new Navigator(context, frame)); }
     virtual ~Navigator();
 
     String appVersion() const;
@@ -48,7 +48,7 @@ public:
     void getStorageUpdates();
 
 private:
-    explicit Navigator(Frame&);
+    explicit Navigator(ScriptExecutionContext&, Frame&);
 
     mutable RefPtr<DOMPluginArray> m_plugins;
     mutable RefPtr<DOMMimeTypeArray> m_mimeTypes;
index b318238..5e4a6e5 100644 (file)
 
 namespace WebCore {
 
+NavigatorBase::NavigatorBase(ScriptExecutionContext& context)
+#if ENABLE(SERVICE_WORKER)
+    : m_serviceWorkerContainer(makeUniqueRef<ServiceWorkerContainer>(context, *this))
+#endif
+{
+#if !ENABLE(SERVICE_WORKER)
+    UNUSED_PARAM(context);
+#endif
+}
+
 NavigatorBase::~NavigatorBase()
 {
 }
@@ -148,10 +158,7 @@ Vector<String> NavigatorBase::languages()
 #if ENABLE(SERVICE_WORKER)
 ServiceWorkerContainer* NavigatorBase::serviceWorker()
 {
-    if (!m_serviceWorkerContainer)
-        m_serviceWorkerContainer = ServiceWorkerContainer::create(*this);
-
-    return m_serviceWorkerContainer.get();
+    return &m_serviceWorkerContainer;
 }
 #endif
 
index ecae3d6..8e06fa2 100644 (file)
 #include "ServiceWorkerContainer.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
+#include <wtf/UniqueRef.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
+class ScriptExecutionContext;
+
 class NavigatorBase : public RefCounted<NavigatorBase> {
 public:
     virtual ~NavigatorBase();
@@ -52,12 +55,15 @@ public:
     static String language();
     static Vector<String> languages();
 
+protected:
+    explicit NavigatorBase(ScriptExecutionContext&);
+
 #if ENABLE(SERVICE_WORKER)
 public:
     ServiceWorkerContainer* serviceWorker();
 
 private:
-    std::unique_ptr<ServiceWorkerContainer> m_serviceWorkerContainer;
+    UniqueRef<ServiceWorkerContainer> m_serviceWorkerContainer;
 #endif
 };
 
index a2e42bb..d7546dc 100644 (file)
@@ -29,8 +29,9 @@
 
 namespace WebCore {
 
-WorkerNavigator::WorkerNavigator(const String& userAgent)
-    : m_userAgent(userAgent)
+WorkerNavigator::WorkerNavigator(ScriptExecutionContext& context, const String& userAgent)
+    : NavigatorBase(context)
+    , m_userAgent(userAgent)
 {
 }
 
index 92fb4b0..8a701fd 100644 (file)
@@ -33,12 +33,12 @@ namespace WebCore {
 
 class WorkerNavigator final : public NavigatorBase, public Supplementable<WorkerNavigator> {
 public:
-    static Ref<WorkerNavigator> create(const String& userAgent) { return adoptRef(*new WorkerNavigator(userAgent)); }
+    static Ref<WorkerNavigator> create(ScriptExecutionContext& context, const String& userAgent) { return adoptRef(*new WorkerNavigator(context, userAgent)); }
 
     String userAgent() const final;
 
 private:
-    explicit WorkerNavigator(const String&);
+    explicit WorkerNavigator(ScriptExecutionContext&, const String&);
 
     String m_userAgent;
 };
index d890111..70afb3b 100644 (file)
 #include "Exception.h"
 #include "JSDOMPromiseDeferred.h"
 #include "NavigatorBase.h"
+#include "ScriptExecutionContext.h"
+#include "URL.h"
 #include <wtf/RunLoop.h>
 
 namespace WebCore {
 
-static void rejectLater(Ref<DeferredPromise>&& promise, const String& methodName)
-{
-    RunLoop::current().dispatch([promise = WTFMove(promise), methodName] {
-        promise->reject(Exception(UnknownError, makeString("ServiceWorkerContainer method '", methodName, "' not yet implemented")));
-    });
-}
-
-ServiceWorkerContainer::ServiceWorkerContainer(NavigatorBase& navigator)
-    : m_navigator(navigator)
+ServiceWorkerContainer::ServiceWorkerContainer(ScriptExecutionContext& context, NavigatorBase& navigator)
+    : ActiveDOMObject(&context)
+    , m_navigator(navigator)
 {
+    suspendIfNeeded();
 }
 void ServiceWorkerContainer::refEventTarget()
 {
@@ -63,36 +60,71 @@ ServiceWorker* ServiceWorkerContainer::controller() const
 
 void ServiceWorkerContainer::ready(Ref<DeferredPromise>&& promise)
 {
-    rejectLater(WTFMove(promise), "ready");
+    promise->reject(Exception { UnknownError, ASCIILiteral("serviceWorker.ready() is not yet implemented") });
 }
 
-void ServiceWorkerContainer::addRegistration(const String&, const RegistrationOptions&, Ref<DeferredPromise>&& promise)
+void ServiceWorkerContainer::addRegistration(const String& relativeScriptURL, const RegistrationOptions& options, Ref<DeferredPromise>&& promise)
 {
-    rejectLater(WTFMove(promise), "addRegistration");
+    auto* context = scriptExecutionContext();
+    if (!context) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    if (relativeScriptURL.isEmpty()) {
+        promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() cannot be called with an empty script URL") });
+        return;
+    }
+
+    auto scriptURL = context->completeURL(relativeScriptURL);
+    if (!scriptURL.isValid()) {
+        promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() must be called with a valid relative script URL") });
+        return;
+    }
+
+    // FIXME: The spec disallows scripts outside of HTTP(S), but we'll likely support app custom URL schemes in WebKit.
+    if (!scriptURL.protocolIsInHTTPFamily()) {
+        promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() must be called with a script URL whose protocol is either HTTP or HTTPS") });
+        return;
+    }
+
+    String path = scriptURL.path();
+    if (path.containsIgnoringASCIICase("%2f") || path.containsIgnoringASCIICase("%5c")) {
+        promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() must be called with a script URL whose path does not contain '%%2f' or '%%5c'") });
+        return;
+    }
+
+    String scope = options.scope.isEmpty() ? ASCIILiteral("./") : options.scope;
+    auto scopeURL = context->completeURL(scope);
+
+    // FIXME: At this point, create a Register job and add it to the job queue
+    UNUSED_PARAM(scopeURL);
+
+    promise->reject(Exception { UnknownError, ASCIILiteral("serviceWorker.register() is not yet implemented") });
 }
 
 void ServiceWorkerContainer::getRegistration(const String&, Ref<DeferredPromise>&& promise)
 {
-    rejectLater(WTFMove(promise), "getRegistration");
+    promise->reject(Exception { UnknownError, ASCIILiteral("serviceWorker.getRegistration() is not yet implemented") });
 }
 
 void ServiceWorkerContainer::getRegistrations(Ref<DeferredPromise>&& promise)
 {
-    rejectLater(WTFMove(promise), "getRegistrations");
+    promise->reject(Exception { UnknownError, ASCIILiteral("serviceWorker.getRegistrations() is not yet implemented") });
 }
 
 void ServiceWorkerContainer::startMessages()
 {
 }
 
-EventTargetInterface ServiceWorkerContainer::eventTargetInterface() const
+const char* ServiceWorkerContainer::activeDOMObjectName() const
 {
-    return ServiceWorkerContainerEventTargetInterfaceType;
+    return "ServiceWorkerContainer";
 }
 
-ScriptExecutionContext* ServiceWorkerContainer::scriptExecutionContext() const
+bool ServiceWorkerContainer::canSuspendForDocumentSuspension() const
 {
-    return nullptr;
+    return true;
 }
 
 } // namespace WebCore
index 976e8a5..3153fba 100644 (file)
@@ -27,6 +27,7 @@
 
 #if ENABLE(SERVICE_WORKER)
 
+#include "ActiveDOMObject.h"
 #include "EventTarget.h"
 
 namespace WebCore {
@@ -35,17 +36,18 @@ class DeferredPromise;
 class NavigatorBase;
 class ServiceWorker;
 
-class ServiceWorkerContainer final : public EventTargetWithInlineData {
+enum class ServiceWorkerUpdateViaCache;
+enum class WorkerType;
+
+class ServiceWorkerContainer final : public EventTargetWithInlineData, public ActiveDOMObject {
 public:
-    static std::unique_ptr<ServiceWorkerContainer> create(NavigatorBase& navigator)
-    {
-        return std::make_unique<ServiceWorkerContainer>(navigator);
-    }
-    explicit ServiceWorkerContainer(NavigatorBase&);
+    ServiceWorkerContainer(ScriptExecutionContext&, NavigatorBase&);
     virtual ~ServiceWorkerContainer() = default;
 
     struct RegistrationOptions {
         String scope;
+        WorkerType type;
+        ServiceWorkerUpdateViaCache updateViaCache;
     };
 
     ServiceWorker* controller() const;
@@ -58,8 +60,10 @@ public:
     void startMessages();
 
 private:
-    virtual EventTargetInterface eventTargetInterface() const;
-    virtual ScriptExecutionContext* scriptExecutionContext() const;
+    const char* activeDOMObjectName() const final;
+    bool canSuspendForDocumentSuspension() const final;
+    ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
+    EventTargetInterface eventTargetInterface() const final { return ServiceWorkerContainerEventTargetInterfaceType; }
     void refEventTarget() final;
     void derefEventTarget() final;
 
index 5463e42..76aa624 100644 (file)
@@ -49,8 +49,6 @@
 
 dictionary RegistrationOptions {
     USVString scope;
-
-    // FIXME: Add these back after first round of IDL stubbing.
-    // WorkerType type = "classic";
-    // ServiceWorkerUpdateViaCache updateViaCache = "imports";
+    WorkerType type = "classic";
+    ServiceWorkerUpdateViaCache updateViaCache = "imports";
 };
index 5b581eb..5dd8374 100644 (file)
@@ -50,12 +50,19 @@ const String& ServiceWorkerRegistration::scope() const
     return emptyString();
 }
 
-void ServiceWorkerRegistration::update(Ref<DeferredPromise>&&)
+ServiceWorkerRegistration::UpdateViaCache ServiceWorkerRegistration::updateViaCache() const
 {
+    return UpdateViaCache::Imports;
 }
 
-void ServiceWorkerRegistration::unregister(Ref<DeferredPromise>&&)
+void ServiceWorkerRegistration::update(Ref<DeferredPromise>&& promise)
 {
+    promise->reject(Exception(UnknownError, ASCIILiteral("ServiceWorkerRegistration::update not yet implemented")));
+}
+
+void ServiceWorkerRegistration::unregister(Ref<DeferredPromise>&& promise)
+{
+    promise->reject(Exception(UnknownError, ASCIILiteral("ServiceWorkerRegistration::unregister not yet implemented")));
 }
 
 EventTargetInterface ServiceWorkerRegistration::eventTargetInterface() const
index 3661e60..f744896 100644 (file)
@@ -37,6 +37,12 @@ class ServiceWorker;
 
 class ServiceWorkerRegistration final : public EventTargetWithInlineData {
 public:
+    enum class UpdateViaCache {
+        Imports,
+        All,
+        None,
+    };
+
     static Ref<ServiceWorkerRegistration> create(Frame& frame) { return adoptRef(*new ServiceWorkerRegistration(frame)); }
     virtual ~ServiceWorkerRegistration() = default;
 
@@ -45,6 +51,7 @@ public:
     ServiceWorker* active();
 
     const String& scope() const;
+    UpdateViaCache updateViaCache() const;
 
     void update(Ref<DeferredPromise>&&);
     void unregister(Ref<DeferredPromise>&&);
index 2a62300..32e6dcb 100644 (file)
@@ -37,9 +37,7 @@
     readonly attribute ServiceWorker? active;
 
     readonly attribute USVString scope;
-
-    // FIXME: Implement when ready.
-    // readonly attribute ServiceWorkerUpdateViaCache updateViaCache;
+    readonly attribute ServiceWorkerUpdateViaCache updateViaCache;
 
     [NewObject] Promise<void> update();
     [NewObject] Promise<boolean> unregister();
@@ -47,3 +45,9 @@
     // event
     attribute EventHandler onupdatefound;
 };
+
+enum ServiceWorkerUpdateViaCache {
+    "imports",
+    "all",
+    "none"
+};
diff --git a/Source/WebCore/workers/ServiceWorkerUpdateViaCache.h b/Source/WebCore/workers/ServiceWorkerUpdateViaCache.h
new file mode 100644 (file)
index 0000000..a0321ab
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+namespace WebCore {
+
+enum class ServiceWorkerUpdateViaCache {
+    Imports,
+    All,
+    None,
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
diff --git a/Source/WebCore/workers/ServiceWorkerUpdateViaCache.idl b/Source/WebCore/workers/ServiceWorkerUpdateViaCache.idl
new file mode 100644 (file)
index 0000000..42c7156
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[Conditional=SERVICE_WORKER] enum ServiceWorkerUpdateViaCache {
+    "imports",
+    "all",
+    "none"
+};
index e595c58..2e23b19 100644 (file)
@@ -190,10 +190,10 @@ void WorkerGlobalScope::close()
     } });
 }
 
-WorkerNavigator& WorkerGlobalScope::navigator() const
+WorkerNavigator& WorkerGlobalScope::navigator()
 {
     if (!m_navigator)
-        m_navigator = WorkerNavigator::create(m_userAgent);
+        m_navigator = WorkerNavigator::create(*this, m_userAgent);
     return *m_navigator;
 }
 
index b6e04f1..a04ba27 100644 (file)
@@ -81,7 +81,7 @@ public:
     void close();
 
     virtual ExceptionOr<void> importScripts(const Vector<String>& urls);
-    WorkerNavigator& navigator() const;
+    WorkerNavigator& navigator();
 
     ExceptionOr<int> setTimeout(JSC::ExecState&, std::unique_ptr<ScheduledAction>, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments);
     void clearTimeout(int timeoutId);
diff --git a/Source/WebCore/workers/WorkerType.h b/Source/WebCore/workers/WorkerType.h
new file mode 100644 (file)
index 0000000..0b0ed86
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class WorkerType {
+    Classic,
+    Module,
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/workers/WorkerType.idl b/Source/WebCore/workers/WorkerType.idl
new file mode 100644 (file)
index 0000000..ae9fffb
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+enum WorkerType {
+    "classic",
+    "module"
+};