Re: [w3c/ServiceWorker] InstallEvent.addRoutes is resolving/rejecting the returned promise synchronously (Issue #1742)

> Let's first wait on [#1744](https://github.com/w3c/ServiceWorker/pull/1744), we can then put up a PR for this one.

Sure.

> If the browser process is doing the validation checks, is it needed to also do them in the render process as well? Given this is observable from JS, we need to make a conscious decision here.

Yeah, I also had the same question when I implemented this, and decided this way upon the following reasons:

1. especially for JavaScript code, the renderer can access more information easier than the browser process, and it might be more easy to give a precise feedback.
2. I prefer a quick feedback than a lazy feedback.  Since a frequent problem should be a syntax error, telling mistakes synchronously should be better than asynchronously.
3. the install event is rarely executed.  Maybe either of just after `register()` or update.  It is also be an asynchronous process except the web developers explicitly asks.  I supposed it fine to take time for its execution.
4. considering the time to set up the rules and evaluate the rules, which is already explained in the specification, web developers may not set too large rules.  Then, the verification may not take so long time to execute.
5. considering the time to write to persistent storage for future navigations, verifying rules should be light-weight.

Note that in Chromium, verifying failure in the browser process will bring the renderer to be killed except for the case caused by the regular expression implementation difference.

> In specs term, it means that either we do the checks synchronously (and implementation will actually do them twice), or we run these checks inside an `in parallel` block.

I suppose the time to verify is negligibly small and I currently do not come up with use case that the difference matters, but I prefer to keep it synchronous except for the persistent storage update.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1742#issuecomment-2606715622
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1742/2606715622@github.com>

Received on Wednesday, 22 January 2025 09:30:52 UTC