w3ctag / design-reviews

W3C specs and API reviews
Creative Commons Zero v1.0 Universal
322 stars 55 forks source link

Skip no-op service worker fetch handler #815

Closed yoshisatoyanagisawa closed 1 year ago

yoshisatoyanagisawa commented 1 year ago

Wotcher TAG!

I'm requesting a TAG review of skip no-op service worker fetch handler.

Some sites have a no-op (no operation) fetch handler (e.g. onfetch = () => {}). Since having the fetch handler was one of the requirements to be a progressive web app (PWA), we assume that they did that to make their site recognized as PWA. However, it only brings overheads to start a service worker and execute a no-op handler without bringing any feature benefits like caching or offline capabilities because the code does nothing. To make the navigation to such pages faster, we would like to omit the service worker start and the handler execution from the navigation critical path if a user agent identifies that the service worker fetch handler is no-op.

This is mostly a behind-the-scenes performance improvement. However, it can subtly change the behavior in edge cases, such as dynamically-updated fetch handlers.

Further details:

You should also know that...

[please tell us anything you think is relevant to this review]

We'd prefer the TAG provide feedback as (please delete all but the desired option):

🐛 open issues in our GitHub repo for each point of feedback

ylafon commented 1 year ago

We looked at this during our last teleconference and we have the following observation: If it is still common practise to register a (potentially) noop, then it should be advertised that it is not a good practise. In the meantime, we see this as a good temporary optimisation, but it would be good to easily roll it back when the number of such cases are low enough. Thanks