Title: [220310] trunk
Revision
220310
Author
beid...@apple.com
Date
2017-08-04 21:59:48 -0700 (Fri, 04 Aug 2017)

Log Message

Have navigator.serviceWorker() actually return a ServiceWorkerContainer object.
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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (220309 => 220310)


--- trunk/LayoutTests/ChangeLog	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/ChangeLog	2017-08-05 04:59:48 UTC (rev 220310)
@@ -1,3 +1,12 @@
+2017-08-04  Brady Eidson  <beid...@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  <cdu...@apple.com>
 
         Add test coverage for sendBeacon() keepalive flag

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-08-05 04:59:48 UTC (rev 220310)
@@ -1,3 +1,44 @@
+2017-08-04  Brady Eidson  <beid...@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  <cdu...@apple.com>
 
         [Beacon] Update sendBeacon to use the CachedResourceLoader

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -6,4 +6,5 @@
 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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/background-fetch/interfaces-worker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/background-fetch/interfaces-worker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/background-fetch/interfaces-worker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -3,5 +3,5 @@
 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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/messageevent-constructor.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/messageevent-constructor.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/messageevent-constructor.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -6,5 +6,5 @@
 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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-agent-formalism/canblock-serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-agent-formalism/canblock-serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-agent-formalism/canblock-serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/byte-length-queuing-strategy.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/byte-length-queuing-strategy.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/byte-length-queuing-strategy.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/count-queuing-strategy.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/count-queuing-strategy.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/count-queuing-strategy.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-backward.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-backward.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-backward.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-forward.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-forward.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/close-propagation-forward.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-forward.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-forward.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/error-propagation-forward.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/flow-control.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/flow-control.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/flow-control.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/general.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/general.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/general.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/multiple-propagation.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/multiple-propagation.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/multiple-propagation.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/pipe-through.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/pipe-through.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/pipe-through.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/transform-streams.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/transform-streams.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/piping/transform-streams.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-byte-streams/general.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-strategies.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-strategies.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-strategies.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/bad-underlying-sources.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/brand-checks.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/brand-checks.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/brand-checks.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/cancel.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/cancel.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/cancel.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/default-reader.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/default-reader.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/default-reader.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/floating-point-total-queue-size.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/floating-point-total-queue-size.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/floating-point-total-queue-size.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/garbage-collection.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/garbage-collection.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/garbage-collection.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/general.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/pipe-through.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/pipe-through.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/pipe-through.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/readable-stream-reader.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/readable-stream-reader.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/readable-stream-reader.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/tee.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/templated.serviceworker.https-expected.txt (220309 => 220310)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/templated.serviceworker.https-expected.txt	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/streams/readable-streams/templated.serviceworker.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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
 

Copied: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt (from rev 220309, trunk/LayoutTests/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt) (0 => 220310)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/FileAPI/historical.https-expected.txt	2017-08-05 04:59:48 UTC (rev 220310)
@@ -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 
+

Modified: trunk/Source/WebCore/ChangeLog (220309 => 220310)


--- trunk/Source/WebCore/ChangeLog	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/Source/WebCore/ChangeLog	2017-08-05 04:59:48 UTC (rev 220310)
@@ -1,3 +1,25 @@
+2017-08-04  Brady Eidson  <beid...@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  <cdu...@apple.com>
 
         [Beacon] Update sendBeacon to use the CachedResourceLoader

Modified: trunk/Source/WebCore/page/NavigatorBase.cpp (220309 => 220310)


--- trunk/Source/WebCore/page/NavigatorBase.cpp	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/Source/WebCore/page/NavigatorBase.cpp	2017-08-05 04:59:48 UTC (rev 220310)
@@ -148,7 +148,10 @@
 #if ENABLE(SERVICE_WORKER)
 ServiceWorkerContainer* NavigatorBase::serviceWorker()
 {
-    return nullptr;
+    if (!m_serviceWorkerContainer)
+        m_serviceWorkerContainer = ServiceWorkerContainer::create(*this);
+
+    return m_serviceWorkerContainer.get();
 }
 #endif
 

Modified: trunk/Source/WebCore/page/NavigatorBase.h (220309 => 220310)


--- trunk/Source/WebCore/page/NavigatorBase.h	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/Source/WebCore/page/NavigatorBase.h	2017-08-05 04:59:48 UTC (rev 220310)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "ServiceWorkerContainer.h"
 #include <wtf/Forward.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -31,10 +32,6 @@
 
 namespace WebCore {
 
-#if ENABLE(SERVICE_WORKER)
-class ServiceWorkerContainer;
-#endif
-
 class NavigatorBase : public RefCounted<NavigatorBase> {
 public:
     virtual ~NavigatorBase();
@@ -56,7 +53,11 @@
     static Vector<String> languages();
 
 #if ENABLE(SERVICE_WORKER)
+public:
     ServiceWorkerContainer* serviceWorker();
+
+private:
+    std::unique_ptr<ServiceWorkerContainer> m_serviceWorkerContainer;
 #endif
 };
 

Modified: trunk/Source/WebCore/workers/ServiceWorkerContainer.cpp (220309 => 220310)


--- trunk/Source/WebCore/workers/ServiceWorkerContainer.cpp	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/Source/WebCore/workers/ServiceWorkerContainer.cpp	2017-08-05 04:59:48 UTC (rev 220310)
@@ -28,28 +28,57 @@
 
 #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()

Modified: trunk/Source/WebCore/workers/ServiceWorkerContainer.h (220309 => 220310)


--- trunk/Source/WebCore/workers/ServiceWorkerContainer.h	2017-08-05 02:14:16 UTC (rev 220309)
+++ trunk/Source/WebCore/workers/ServiceWorkerContainer.h	2017-08-05 04:59:48 UTC (rev 220310)
@@ -32,12 +32,16 @@
 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 @@
     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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to