[w3c/ServiceWorker] What should happen in case of large number of added routes? (Issue #1746)

If the service worker is adding too many routes, two things may happen:
1. testing the routes will take a long time, delaying loads
2. storing the routes may fill up the user's storage

I guess that setting a limit on the number of routes might be nice here.
For 1, maybe a TypeError or InvalidStateError be good.
For 2, maybe a QuotaError would be good.


Looking at Chrome's implementation, https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/common/service_worker/service_worker_router_rule.h;l=33;drc=27d34700b83f381c62e3a348de2e6dfdc08364b8;bpv=1;bpt=1, it seems that there is a max number of 256.

Chrome is also imposing a max depth for conditions of 10, which is aligned with the goal to limit the time to test the routes.

The spec should probably give guidelines for implementors, if not adding some checks in the algorithms.

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

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

Received on Wednesday, 22 January 2025 08:43:35 UTC