Bug 180959

Summary: Handle Fetch should wait for the service worker's state to become activated
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Service WorkersAssignee: Cris Neckar <cdn>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, commit-queue, ggaren, jbedard, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=180990
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Chris Dumez 2017-12-18 16:46:47 PST
Handle Fetch should wait for the service worker's state to become activated when it is currently activating.

Specification:
- https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (Step 16)
Comment 1 Chris Dumez 2017-12-18 17:24:24 PST
Created attachment 329715 [details]
Patch
Comment 2 Chris Dumez 2017-12-18 20:29:50 PST
Created attachment 329732 [details]
Patch
Comment 3 youenn fablet 2017-12-19 10:40:42 PST
Comment on attachment 329732 [details]
Patch

So we keep the pending fetch in storage process until service worker is active.
Another option would be to send the fetch to the service worker process and wait there, but this is probably less safe?
Comment 4 WebKit Commit Bot 2017-12-19 10:42:41 PST
Comment on attachment 329732 [details]
Patch

Rejecting attachment 329732 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 329732, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
8.
1 out of 1 hunk FAILED -- saving rejects to file Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp.rej
patching file LayoutTests/imported/w3c/ChangeLog
Hunk #1 succeeded at 1 with fuzz 3.
patching file LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https-expected.txt

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Youenn Fablet']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: http://webkit-queues.webkit.org/results/5754744
Comment 5 Chris Dumez 2017-12-19 10:45:57 PST
(In reply to youenn fablet from comment #3)
> Comment on attachment 329732 [details]
> Patch
> 
> So we keep the pending fetch in storage process until service worker is
> active.
> Another option would be to send the fetch to the service worker process and
> wait there, but this is probably less safe?

The spec says to first wait for activated and then call runServiceWorker, which is why I put the check there.
Comment 6 Chris Dumez 2017-12-19 11:12:28 PST
Created attachment 329777 [details]
Patch
Comment 7 Chris Dumez 2017-12-19 11:48:34 PST
Created attachment 329781 [details]
Patch
Comment 8 Chris Dumez 2017-12-19 12:12:10 PST
Created attachment 329789 [details]
Patch
Comment 9 WebKit Commit Bot 2017-12-19 13:22:25 PST
Comment on attachment 329789 [details]
Patch

Clearing flags on attachment: 329789

Committed r226136: <https://trac.webkit.org/changeset/226136>
Comment 10 WebKit Commit Bot 2017-12-19 13:22:27 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Radar WebKit Bug Importer 2017-12-19 13:23:37 PST
<rdar://problem/36139197>