Summary: | Service worker methods register and update are not working as expected in WKWebView | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Kiran S <18kirans> | ||||
Component: | Service Workers | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED CONFIGURATION CHANGED | ||||||
Severity: | Normal | CC: | cdumez, deepa.gopikuttan.pillai, jarilittlenen, katherine_cheney, kiran.satheesan, mehmetgelisin, prabakar.paulsami, webkit-bug-importer, youennf | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | Other | ||||||
Hardware: | iPhone / iPad | ||||||
OS: | iOS 14 | ||||||
Attachments: |
|
Description
Kiran S
2021-06-30 08:34:41 PDT
App bound domains -> Kate. Hi, thanks for the report. (In reply to Kiran S from comment #0) > Created attachment 432597 [details] > Screenshots for service worker registration and update error > > Overview > > Currently all app bound domains are not allowed to register a service > worker. > > From the observations it seems like there seems to be a limit of 3 > service worker per WebView (Not per domain). > So if there are 5 app bound domains which have service worker. Only the > 3 domains loaded first would be able to register their service workers. > > The next registration attempt would fail with the following error. > "TypeError: Job rejected for non app-bound domain" > Even though the domain is app bound and doesn't have any previous > service worker registrations. > This is expected, the max number of service workers for any WKWebView using app bound domains is 3. > Also once the limit of 3 is reached it was not possible to update any of > the registered service workers as well. > I would not expect this, and will look into it. > Note: I saw the ticket where the limitation of 3 service workers was > added - https://bugs.webkit.org/show_bug.cgi?id=213601. > But it was not clear if this was intended for the whole webview since > there could be multiple app bound domains and subdomains. > > > Steps to Reproduce > > 1. Prepare 4 separate domains or subdomains with service worker support. > These should be valid App Bound Domains. > 2. Load each domain one after another and verify service worker > registration. > 3. After all the domains are loaded. Try to update any of the existing > service worker registrations. > > Actual Result > > - The first 3 "navigator.serviceWorker.register" method invocations > would successfully register service workers for respective domains. > The fourth registration attempt fails with the error - "TypeError: > Job rejected for non app-bound domain" > > - After the limit of 3 is reached. It was not possible to update any of > the registered service workers as well. > Attempting to do so would also throw the same error - "TypeError: Job > rejected for non app-bound domain" > > Expected Result > > - navigator.serviceWorker.register would successfully register service > worker for a valid app bound domain. > > - ServiceWorkerRegistration.update should update existing service > worker registrations. > > Environment > > Device: iPad Mini 4 > OS: iOS 14.7 (18G5042c) > > Additional Info > > In our use case there are dynamic subdomains which would need service > worker support. > Currently we register the parent domain as app bound and we are getting > service worker support for the targeted domains. > But the issue we are facing currently is that the limit of 3 service > workers seems to be across all app bound domains. Thanks for sharing details about your use case. The limit of 3 service workers across all app-bound domains is intended behavior. I'll take a look at the issue you're experiencing trying to update registered workers, as I would not expect that behavior. Hi, Thanks for the update. We can manage with the limit of 3 service workers as long as - Registered service workers can be unregistered - Registered service workers can be updated Currently unregister is also blocked - https://bugs.webkit.org/show_bug.cgi?id=227524 Closing this bug in favour of https://bugs.webkit.org/show_bug.cgi?id=229554 |