Bug 213601

Summary: App-bound domain service worker registrations should be limited
Product: WebKit Reporter: Kate Cheney <katherine_cheney>
Component: WebKit Misc.Assignee: Kate Cheney <katherine_cheney>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, bfulgham, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Kate Cheney 2020-06-25 07:41:46 PDT
We should limit the number of service worker registrations available to app-bound domains
Comment 1 Kate Cheney 2020-06-25 07:42:05 PDT
<rdar://problem/64717589>
Comment 2 Kate Cheney 2020-06-25 07:49:03 PDT
Created attachment 402733 [details]
Patch
Comment 3 Brent Fulgham 2020-06-25 10:47:33 PDT
Comment on attachment 402733 [details]
Patch

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

> Source/WebCore/workers/service/server/SWServer.cpp:338
> +        completionHandler(m_appBoundDomains.contains(domain) && m_scopeToRegistrationMap.keys().size() < maxRegistrationCount);

It seems like this code change also limits full web browsers to three registrations. Is that desired?
Comment 4 Kate Cheney 2020-06-25 10:58:17 PDT
Comment on attachment 402733 [details]
Patch

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

>> Source/WebCore/workers/service/server/SWServer.cpp:338
>> +        completionHandler(m_appBoundDomains.contains(domain) && m_scopeToRegistrationMap.keys().size() < maxRegistrationCount);
> 
> It seems like this code change also limits full web browsers to three registrations. Is that desired?

It won't because the completion handler result will only be checked if the entitlement is not present (see SWServer::scheduleJob and SWServer::addRegistrationFromStore). It's a little confusing but we added the check here to prevent the app-bound domains from being read unnecessarily.
Comment 5 Brent Fulgham 2020-06-25 11:09:34 PDT
Comment on attachment 402733 [details]
Patch

r=me
Comment 6 Kate Cheney 2020-06-25 11:13:37 PDT
Comment on attachment 402733 [details]
Patch

Thanks!
Comment 7 EWS 2020-06-25 11:16:26 PDT
Committed r263521: <https://trac.webkit.org/changeset/263521>

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