Skip to content

Commit 9f380a1

Browse files
committed
Define 1024 as a upper limit of total registered router rules
1 parent 013e136 commit 9f380a1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

docs/index.bs

+9-2
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
212212

213213
A [=/service worker=] has an associated <dfn>list of router rules</dfn> (a [=list=] of {{RouterRule}}s). It is initially an empty [=list=].
214214

215+
A [=/service worker=] has an associated <dfn>router rule count</dfn> (the number of registered {{RouterRule}}s). It is initially set to zero.
216+
217+
Note: [=router rule count=] is defined as the limit of the total number of registered router rules. This prevents the user agent from spending much resources by evaluating too many router rules. The limit is 1024.
218+
215219
A [=/service worker=] is said to be <dfn>running</dfn> if its [=event loop=] is running.
216220

217221
<section>
@@ -3401,9 +3405,9 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
34013405
Note: For ease of understanding the router rule, the "or" condition is mutually exclusive with other conditions.
34023406

34033407
1. Let |orConditions| be |condition|["{{RouterCondition/_or}}"].
3404-
3408+
34053409
Note: To limit the resource usage and a condition evaluation time, |orConditions|'s [=list/size=] can be limited.
3406-
3410+
34073411
1. For each |orCondition| of |orConditions|:
34083412
1. If running the [=Verify Router Condition=] algorithm with |orCondition| and |serviceWorker| returns false, return false.
34093413
1. Set |hasCondition| to true.
@@ -3414,6 +3418,9 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
34143418

34153419
1. If running the [=Verify Router Condition=] algorithm with |condition|["{{RouterCondition/not}}"] and |serviceWorker| returns false, return false.
34163420
1. Set |hasCondition| to true.
3421+
1. If |hasCondition| is true, then:
3422+
1. Increament |serviceWorker|'s [=service worker/router rule count=] by one.
3423+
1. If |serviceWorker|'s [=service worker/router rule count=] exceeds 1024, which is the limit of registered router rules, return false.
34173424
1. Return |hasCondition|.
34183425
</section>
34193426

0 commit comments

Comments
 (0)