Bug 209666

Summary: Remove synchronous termination of service workers
Product: WebKit Reporter: youenn fablet <youennf>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing none

Description youenn fablet 2020-03-27 11:06:22 PDT
Remove synchronous termination of service workers
Comment 1 youenn fablet 2020-03-30 00:57:42 PDT
Created attachment 394890 [details]
Patch
Comment 2 youenn fablet 2020-03-30 05:47:47 PDT
Created attachment 394908 [details]
Patch
Comment 3 youenn fablet 2020-03-30 07:08:42 PDT
<rdar://problem/59318239>
Comment 4 Chris Dumez 2020-03-30 08:09:46 PDT
Comment on attachment 394908 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394908&action=review

> Source/WebCore/ChangeLog:8
> +        Instead of supporting sycnhronous IPC to terminate a service worker, SWServerWorker will asynchronously ask for the service worker to terminate.

Typo: sycnhronous

> Source/WebCore/workers/service/WorkerSWClientConnection.cpp:161
> +    notImplemented();

What's this?

> Source/WebCore/workers/service/server/SWServerWorker.cpp:126
> +void SWServerWorker::terminateCompleted()

startTermination -> terminationCompleted would be more consistent.
Comment 5 youenn fablet 2020-03-30 08:11:44 PDT
> > Source/WebCore/workers/service/WorkerSWClientConnection.cpp:161
> > +    notImplemented();
> 
> What's this?

We are not calling terminate from a worker but only from a document and for testing purposes.
Plan is to add support for it should we need to call this for testing from workers.
Comment 6 Chris Dumez 2020-03-30 08:17:44 PDT
(In reply to youenn fablet from comment #5)
> > > Source/WebCore/workers/service/WorkerSWClientConnection.cpp:161
> > > +    notImplemented();
> > 
> > What's this?
> 
> We are not calling terminate from a worker but only from a document and for
> testing purposes.
> Plan is to add support for it should we need to call this for testing from
> workers.

It looks like something that used to work and no longer does, aka a regression. How hard would it be to keep it working?
Comment 7 youenn fablet 2020-03-30 08:41:54 PDT
(In reply to Chris Dumez from comment #6)
> (In reply to youenn fablet from comment #5)
> > > > Source/WebCore/workers/service/WorkerSWClientConnection.cpp:161
> > > > +    notImplemented();
> > > 
> > > What's this?
> > 
> > We are not calling terminate from a worker but only from a document and for
> > testing purposes.
> > Plan is to add support for it should we need to call this for testing from
> > workers.
> 
> It looks like something that used to work and no longer does, aka a
> regression. How hard would it be to keep it working?

We could and it would be fairly simple (although we would add a Vector<callback>) but I do not think this is worth it.
Another option is to move this API to ServiceWorkerProvider so that only Documents would do that. I would tend to go this way in that case.
Comment 8 Chris Dumez 2020-03-30 08:44:44 PDT
Comment on attachment 394908 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=394908&action=review

>> Source/WebCore/workers/service/WorkerSWClientConnection.cpp:161
>> +    notImplemented();
> 
> What's this?

This looks bad. I think we should either make it work or drop this code (assuming it is not currently useful). Going from something that works to something notImplemented() does not seem like the right thing to do.
Comment 9 youenn fablet 2020-03-30 09:05:48 PDT
Created attachment 394924 [details]
Patch
Comment 10 youenn fablet 2020-04-01 01:54:15 PDT
Ping review.
Comment 11 Chris Dumez 2020-04-01 12:34:28 PDT
Comment on attachment 394924 [details]
Patch

r=me
Comment 12 EWS 2020-04-02 00:54:20 PDT
Patch 394924 does not build
Comment 13 youenn fablet 2020-04-02 03:02:18 PDT
Created attachment 395256 [details]
Patch for landing
Comment 14 EWS 2020-04-02 04:00:59 PDT
Committed r259383: <https://trac.webkit.org/changeset/259383>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395256 [details].