RESOLVED FIXED 179396
[Service Workers] Support waitUntil() on the 'install' event
https://bugs.webkit.org/show_bug.cgi?id=179396
Summary [Service Workers] Support waitUntil() on the 'install' event
Chris Dumez
Reported 2017-11-07 15:03:49 PST
Support waitUntil() on the 'install' event: - https://w3c.github.io/ServiceWorker/#installation-algorithm (step 10.4)
Attachments
WIP Patch (11.98 KB, patch)
2017-11-07 16:13 PST, Chris Dumez
buildbot: commit-queue-
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (2.60 MB, application/zip)
2017-11-07 17:27 PST, Build Bot
no flags
Archive of layout-test-results from ews125 for ios-simulator-wk2 (2.33 MB, application/zip)
2017-11-07 17:47 PST, Build Bot
no flags
WIP Patch (14.45 KB, patch)
2017-11-07 18:37 PST, Chris Dumez
no flags
WIP Patch (21.45 KB, patch)
2017-11-07 19:28 PST, Chris Dumez
no flags
WIP Patch (23.92 KB, patch)
2017-11-07 19:35 PST, Chris Dumez
no flags
WIP Patch (23.84 KB, patch)
2017-11-07 19:36 PST, Chris Dumez
no flags
WIP Patch (25.97 KB, patch)
2017-11-07 19:43 PST, Chris Dumez
no flags
WIP Patch (26.78 KB, patch)
2017-11-07 20:06 PST, Chris Dumez
no flags
Patch (34.83 KB, patch)
2017-11-07 20:18 PST, Chris Dumez
no flags
Patch (32.93 KB, patch)
2017-11-07 20:20 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-11-07 16:13:27 PST
Created attachment 326273 [details] WIP Patch
Build Bot
Comment 2 2017-11-07 17:27:58 PST
Comment on attachment 326273 [details] WIP Patch Attachment 326273 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/5140403 New failing tests: imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html imported/w3c/web-platform-tests/service-workers/service-worker/oninstall-script-error.https.html imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html
Build Bot
Comment 3 2017-11-07 17:27:59 PST
Created attachment 326275 [details] Archive of layout-test-results from ews105 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 4 2017-11-07 17:47:49 PST
Comment on attachment 326273 [details] WIP Patch Attachment 326273 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/5140439 New failing tests: imported/w3c/web-platform-tests/streams/readable-streams/count-queuing-strategy-integration.serviceworker.https.html imported/w3c/web-platform-tests/service-workers/service-worker/oninstall-script-error.https.html imported/w3c/web-platform-tests/service-workers/service-worker/register-wait-forever-in-install-worker.https.html imported/w3c/web-platform-tests/service-workers/service-worker/windowclient-navigate.https.html
Build Bot
Comment 5 2017-11-07 17:47:51 PST
Created attachment 326279 [details] Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Chris Dumez
Comment 6 2017-11-07 18:37:59 PST
Created attachment 326283 [details] WIP Patch
Chris Dumez
Comment 7 2017-11-07 19:28:53 PST
Created attachment 326288 [details] WIP Patch
Build Bot
Comment 8 2017-11-07 19:30:35 PST
Attachment 326288 [details] did not pass style-queue: ERROR: Source/WebCore/workers/service/ServiceWorkerContainer.h:75: The parameter name "registration" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/workers/service/ServiceWorkerContainer.h:76: The parameter name "registration" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 2 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 9 2017-11-07 19:35:29 PST
Created attachment 326289 [details] WIP Patch
Chris Dumez
Comment 10 2017-11-07 19:36:46 PST
Created attachment 326290 [details] WIP Patch
Chris Dumez
Comment 11 2017-11-07 19:43:34 PST
Created attachment 326292 [details] WIP Patch
Chris Dumez
Comment 12 2017-11-07 20:06:33 PST
Created attachment 326294 [details] WIP Patch
Chris Dumez
Comment 13 2017-11-07 20:18:05 PST
Chris Dumez
Comment 14 2017-11-07 20:20:37 PST
Chris Dumez
Comment 15 2017-11-08 09:26:27 PST
Comment on attachment 326296 [details] Patch Clearing flags on attachment: 326296 Committed r224584: <https://trac.webkit.org/changeset/224584>
Chris Dumez
Comment 16 2017-11-08 09:26:28 PST
All reviewed patches have been landed. Closing bug.
youenn fablet
Comment 17 2017-11-08 09:34:05 PST
Comment on attachment 326296 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=326296&action=review > Source/WebCore/workers/service/context/ServiceWorkerThread.cpp:126 > + installEvent->whenAllExtendLifetimePromisesAreSettled([serviceWorkerIdentifier](HashSet<Ref<DOMPromise>>&& extendLifetimePromises) { Removing a promise from the hashset as soon as promise is settled seems simpler and is more efficient. I am not sure why we want to keep references for all promises. In the particular install case, we could instead have a callback taking an allResolved/rejected flag. Would that work with all other cases?
youenn fablet
Comment 18 2017-11-08 09:35:05 PST
Ah I arrived too late there... If the callback(allresolved/rejected) works, I would much prefer this model.
Chris Dumez
Comment 19 2017-11-08 09:41:08 PST
(In reply to youenn fablet from comment #18) > Ah I arrived too late there... > If the callback(allresolved/rejected) works, I would much prefer this model. We can simplify later on. The current design is very flexible since it provides all the promises to the caller. This also matches the spec very closely. I do not really buy the 'more efficient' argument since I do not have to remove anything from the HashSet and I only keep the promises alive until I call the "all promises resolved" callback.
Chris Dumez
Comment 20 2017-11-08 09:47:30 PST
(In reply to Chris Dumez from comment #19) > (In reply to youenn fablet from comment #18) > > Ah I arrived too late there... > > If the callback(allresolved/rejected) works, I would much prefer this model. > > We can simplify later on. The current design is very flexible since it > provides all the promises to the caller. This also matches the spec very > closely. > > I do not really buy the 'more efficient' argument since I do not have to > remove anything from the HashSet and I only keep the promises alive until I > call the "all promises resolved" callback. Note that I am not against the AllResolved/Rejected idea. I just do not think this has to be done now. There will be more users of waitUntil() and I'd rather we simplify the design once all are implemented (correctly).
youenn fablet
Comment 21 2017-11-08 09:56:37 PST
"more efficient" is in the sense that before the patch the promise is collectable as soon as settled. AFAIUI, with this patch, this will not happen until all related promises are settled. This does not seem like an improvement to me. If there is an actual use case for checking each individual promise result, this patch is fine. My guess is that rejected/resolved is probably sufficient.
Chris Dumez
Comment 22 2017-11-08 10:00:21 PST
(In reply to Chris Dumez from comment #20) > (In reply to Chris Dumez from comment #19) > > (In reply to youenn fablet from comment #18) > > > Ah I arrived too late there... > > > If the callback(allresolved/rejected) works, I would much prefer this model. > > > > We can simplify later on. The current design is very flexible since it > > provides all the promises to the caller. This also matches the spec very > > closely. > > > > I do not really buy the 'more efficient' argument since I do not have to > > remove anything from the HashSet and I only keep the promises alive until I > > call the "all promises resolved" callback. > > Note that I am not against the AllResolved/Rejected idea. I just do not > think this has to be done now. There will be more users of waitUntil() and > I'd rather we simplify the design once all are implemented (correctly). I'll let you know once we implement the other call sites properly.
Radar WebKit Bug Importer
Comment 23 2017-11-15 12:07:52 PST
Note You need to log in before you can comment on or make changes to this bug.