Have navigator.serviceWorker() actually return a ServiceWorkerContainer object.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 04:59:48 +0000 (04:59 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 04:59:48 +0000 (04:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175215

Reviewed by Youenn Fablet.

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/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:

* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::serviceWorker): Actually create and remember an object.
* page/NavigatorBase.h:

* workers/ServiceWorkerContainer.cpp:
(WebCore::rejectLater): Asynchronously reject the given promise with an error message.
(WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::refEventTarget): Ref the underlying Navigator.
(WebCore::ServiceWorkerContainer::derefEventTarget): Deref the underlying Navigator.
(WebCore::ServiceWorkerContainer::ready): rejectLater the promise.
(WebCore::ServiceWorkerContainer::addRegistration): Ditto.
(WebCore::ServiceWorkerContainer::getRegistration): Ditto.
(WebCore::ServiceWorkerContainer::getRegistrations): Ditto.
* workers/ServiceWorkerContainer.h:

LayoutTests:

* platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220310 268f45cc-cd09-0410-ab3c-d52691b4dbfc

41 files changed:
LayoutTests/ChangeLog
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/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
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/NavigatorBase.cpp
Source/WebCore/page/NavigatorBase.h
Source/WebCore/workers/ServiceWorkerContainer.cpp
Source/WebCore/workers/ServiceWorkerContainer.h

index dea0aca439a5b44f27bc5423787be00d443380ea..9a11a0bcb9e4ac559a642bd08794ad842b1a4ee1 100644 (file)
@@ -1,3 +1,12 @@
+2017-08-04  Brady Eidson  <beidson@apple.com>
+
+        Have navigator.serviceWorker() actually return a ServiceWorkerContainer object.
+        https://bugs.webkit.org/show_bug.cgi?id=175215
+
+        Reviewed by Youenn Fablet.
+
+        * platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt.
+
 2017-08-04  Chris Dumez  <cdumez@apple.com>
 
         Add test coverage for sendBeacon() keepalive flag
index 63b1df7a28cfaf352357c02123864a73a8c3ce91..a64a7f038aa6ccb5c11830d87ef9fbb291ffd10e 100644 (file)
@@ -1,3 +1,44 @@
+2017-08-04  Brady Eidson  <beidson@apple.com>
+
+        Have navigator.serviceWorker() actually return a ServiceWorkerContainer object.
+        https://bugs.webkit.org/show_bug.cgi?id=175215
+
+        Reviewed by Youenn Fablet.
+
+        * 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/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-04  Chris Dumez  <cdumez@apple.com>
 
         [Beacon] Update sendBeacon to use the CachedResourceLoader
index 2fc4f667a1aaf2e296821fc3feff8ada568cafe2..6537c2b1f8b0ce3171da67e406153246d68e147b 100644 (file)
@@ -6,4 +6,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
 
index 04e4e5e4a2a116c271750141b8d17101a05bc622..7b0f93552529d5fb156631964914b146e0a6ea3b 100644 (file)
@@ -3,5 +3,5 @@ idlharness test
 This test validates the WebIDL included in the Background Fetch API (Service Workers).
 
 
-FAIL Service Worker-scoped tests. null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service Worker-scoped tests. assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index ccffec0f17231ecb634d3198012a7e1b0f9469a3..ba2a5384ee2577a12412a0b05106552737c856b1 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Fetch in service worker: referrer with no-referrer policy null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+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
 
index ccffec0f17231ecb634d3198012a7e1b0f9469a3..ba2a5384ee2577a12412a0b05106552737c856b1 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Fetch in service worker: referrer with no-referrer policy null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+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
 
index f567354feda00379c5832ac4a40670d4942e1121..cce1069b282e4109c2401079046f983df3d881f6 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Fetch in service worker: referrer with origin-when-cross-origin policy null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+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
 
index 69e4b76e31e299524c5e55e18f6bf6ebd5fc8928..c0dec53c057e24195fe439ee5a7a721135ad6cc6 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Fetch in worker: referrer with unsafe-url policy null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Fetch in worker: referrer with unsafe-url policy assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 1436d442f0f31d5d7b55765779f6b5381d4ac780..d2231175cd7dab0c75efd0c6b4993b91b6a7688f 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 null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Passing ServiceWorker for source member assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
index 4869834be3034cb36909d3c4fd31a7764228f3e7..39239979e07539d03a06d9cfb1b8428d207a0b42 100644 (file)
@@ -1,3 +1,3 @@
 
-FAIL Service worker test setup null is not an object (evaluating 'navigator.serviceWorker.getRegistration')
+FAIL Service worker test setup assert_unreached: unregister should not fail: ServiceWorkerContainer method 'getRegistration' not yet implemented Reached unreachable code
 
diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt
new file mode 100644 (file)
index 0000000..2fc4f66
--- /dev/null
@@ -0,0 +1,9 @@
+
+PASS "toNativeLineEndings" should not be supported 
+FAIL "FileError" should not be supported assert_false: expected false got true
+PASS "FileException" should not be supported 
+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 
+
index 84ecf3cd1c1fb41302abebf5b9f56650ee86d35a..51b7e3a74802e908b54ed81aab17f00643f2ea58 100644 (file)
@@ -1,3 +1,25 @@
+2017-08-04  Brady Eidson  <beidson@apple.com>
+
+        Have navigator.serviceWorker() actually return a ServiceWorkerContainer object.
+        https://bugs.webkit.org/show_bug.cgi?id=175215
+
+        Reviewed by Youenn Fablet.
+
+        * page/NavigatorBase.cpp:
+        (WebCore::NavigatorBase::serviceWorker): Actually create and remember an object.
+        * page/NavigatorBase.h:
+
+        * workers/ServiceWorkerContainer.cpp:
+        (WebCore::rejectLater): Asynchronously reject the given promise with an error message.
+        (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
+        (WebCore::ServiceWorkerContainer::refEventTarget): Ref the underlying Navigator.
+        (WebCore::ServiceWorkerContainer::derefEventTarget): Deref the underlying Navigator.
+        (WebCore::ServiceWorkerContainer::ready): rejectLater the promise.
+        (WebCore::ServiceWorkerContainer::addRegistration): Ditto.
+        (WebCore::ServiceWorkerContainer::getRegistration): Ditto.
+        (WebCore::ServiceWorkerContainer::getRegistrations): Ditto.
+        * workers/ServiceWorkerContainer.h:
+
 2017-08-04  Chris Dumez  <cdumez@apple.com>
 
         [Beacon] Update sendBeacon to use the CachedResourceLoader
index 7db3376f73067b8f7ea675234e7570a939ae21c9..b318238377ecc9d236e72a5f65ad2d4721fe49d8 100644 (file)
@@ -148,7 +148,10 @@ Vector<String> NavigatorBase::languages()
 #if ENABLE(SERVICE_WORKER)
 ServiceWorkerContainer* NavigatorBase::serviceWorker()
 {
-    return nullptr;
+    if (!m_serviceWorkerContainer)
+        m_serviceWorkerContainer = ServiceWorkerContainer::create(*this);
+
+    return m_serviceWorkerContainer.get();
 }
 #endif
 
index e0df0d03457b290d59c8e50f9a29fd237acbf6e9..ecae3d6605bfada919ad0bb6e54ba9520e2a8cf1 100644 (file)
 
 #pragma once
 
+#include "ServiceWorkerContainer.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-#if ENABLE(SERVICE_WORKER)
-class ServiceWorkerContainer;
-#endif
-
 class NavigatorBase : public RefCounted<NavigatorBase> {
 public:
     virtual ~NavigatorBase();
@@ -56,7 +53,11 @@ public:
     static Vector<String> languages();
 
 #if ENABLE(SERVICE_WORKER)
+public:
     ServiceWorkerContainer* serviceWorker();
+
+private:
+    std::unique_ptr<ServiceWorkerContainer> m_serviceWorkerContainer;
 #endif
 };
 
index 7cc84104f74e39f71cd7a0d3160ce2b05a4da382..d890111d767202457064b8dea48de81711512e78 100644 (file)
 
 #if ENABLE(SERVICE_WORKER)
 
+#include "Exception.h"
+#include "JSDOMPromiseDeferred.h"
+#include "NavigatorBase.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)
+{
+}
+void ServiceWorkerContainer::refEventTarget()
+{
+    m_navigator.ref();
+}
+
+void ServiceWorkerContainer::derefEventTarget()
+{
+    m_navigator.deref();
+}
 
 ServiceWorker* ServiceWorkerContainer::controller() const
 {
     return nullptr;
 }
 
-void ServiceWorkerContainer::ready(Ref<DeferredPromise>&&)
+void ServiceWorkerContainer::ready(Ref<DeferredPromise>&& promise)
 {
+    rejectLater(WTFMove(promise), "ready");
 }
 
-void ServiceWorkerContainer::addRegistration(const String&, const RegistrationOptions&, Ref<DeferredPromise>&&)
+void ServiceWorkerContainer::addRegistration(const String&, const RegistrationOptions&, Ref<DeferredPromise>&& promise)
 {
+    rejectLater(WTFMove(promise), "addRegistration");
 }
 
-void ServiceWorkerContainer::getRegistration(const String&, Ref<DeferredPromise>&&)
+void ServiceWorkerContainer::getRegistration(const String&, Ref<DeferredPromise>&& promise)
 {
+    rejectLater(WTFMove(promise), "getRegistration");
 }
 
-void ServiceWorkerContainer::getRegistrations(Ref<DeferredPromise>&&)
+void ServiceWorkerContainer::getRegistrations(Ref<DeferredPromise>&& promise)
 {
+    rejectLater(WTFMove(promise), "getRegistrations");
 }
 
 void ServiceWorkerContainer::startMessages()
index 98cb443fcf8b980fc3b1b1f31f6da7b651295cb3..976e8a58cb328a5aa9038b01fcd5c9bfd772f551 100644 (file)
 namespace WebCore {
 
 class DeferredPromise;
-class Frame;
+class NavigatorBase;
 class ServiceWorker;
 
 class ServiceWorkerContainer final : public EventTargetWithInlineData {
 public:
-    static Ref<ServiceWorkerContainer> create(Frame& frame) { return adoptRef(*new ServiceWorkerContainer(frame)); }
+    static std::unique_ptr<ServiceWorkerContainer> create(NavigatorBase& navigator)
+    {
+        return std::make_unique<ServiceWorkerContainer>(navigator);
+    }
+    explicit ServiceWorkerContainer(NavigatorBase&);
     virtual ~ServiceWorkerContainer() = default;
 
     struct RegistrationOptions {
@@ -54,12 +58,12 @@ public:
     void startMessages();
 
 private:
-    explicit ServiceWorkerContainer(Frame&);
-
     virtual EventTargetInterface eventTargetInterface() const;
     virtual ScriptExecutionContext* scriptExecutionContext() const;
-    void refEventTarget() final { ref(); }
-    void derefEventTarget() final { deref(); }
+    void refEventTarget() final;
+    void derefEventTarget() final;
+
+    NavigatorBase& m_navigator;
 };
 
 } // namespace WebCore