Bug 213601 - App-bound domain service worker registrations should be limited
Summary: App-bound domain service worker registrations should be limited
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kate Cheney
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-25 07:41 PDT by Kate Cheney
Modified: 2020-06-25 11:16 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.55 KB, patch)
2020-06-25 07:49 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].