Bug 180359

Summary: Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description youenn fablet 2017-12-04 09:05:41 PST
Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
Comment 1 youenn fablet 2017-12-04 09:42:18 PST
Created attachment 328354 [details]
Patch
Comment 2 Chris Dumez 2017-12-04 10:24:33 PST
Comment on attachment 328354 [details]
Patch

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

> Source/WebCore/workers/service/server/SWServerRegistration.cpp:165
> +    handleClientUnload();

This looks wrong to me. The fact that removeClientUsingRegistration() is called does not necessarily mean a client was unloaded.
Comment 3 Chris Dumez 2017-12-04 10:26:09 PST
Comment on attachment 328354 [details]
Patch

I guess it does not matter though because the algorithm is a no-op when the unloaded client is not using the registration.
Comment 4 Chris Dumez 2017-12-04 10:29:06 PST
Comment on attachment 328354 [details]
Patch

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

yeah, seems fine given the client unload algorithm.

> Source/WebCore/workers/service/server/SWServerRegistration.cpp:293
> +        return;

Technically the spec does not return here. I don't know if is matters or if it is a bug in the spec. Do we ever want to call tryActivate() on a registration that is uninstalling?
Comment 5 youenn fablet 2017-12-04 10:35:42 PST
(In reply to Chris Dumez from comment #4)
> Comment on attachment 328354 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=328354&action=review
> 
> yeah, seems fine given the client unload algorithm.
> 
> > Source/WebCore/workers/service/server/SWServerRegistration.cpp:293
> > +        return;
> 
> Technically the spec does not return here. I don't know if is matters or if
> it is a bug in the spec. Do we ever want to call tryActivate() on a
> registration that is uninstalling?

Right, spec could be made clearer here.
Comment 6 WebKit Commit Bot 2017-12-04 10:55:11 PST
Comment on attachment 328354 [details]
Patch

Clearing flags on attachment: 328354

Committed r225483: <https://trac.webkit.org/changeset/225483>
Comment 7 WebKit Commit Bot 2017-12-04 10:55:12 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2017-12-04 10:56:25 PST
<rdar://problem/35833226>