You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: {{RouterCondition/_or}} and {{RouterCondition/not}} might have the other {{RouterCondition/_or}} or {{RouterCondition/not}} inside. To avoid spending much resources by the nested condition or performance penalty on evaluation, depth of such nested conditions can be limited.
1608
1608
1609
+
A <dfn export id="dfn-count-router-condition-result">count router condition result</dfn> is a [=struct=] that consists of:
1610
+
* A <dfn export id="dfn-count-router-condition-result-total-count" for="count router condition result">total count</dfn> (a number).
1611
+
* A <dfn export id="dfn-dfn-count-router-condition-result-depth" for="count router condition result">depth</dfn> (a number).
1. If running the [=Verify Router Condition=] algorithm with |rule|["{{RouterRule/condition}}"] and |serviceWorker| returns false, return [=a promise rejected with=] a {{TypeError}}.
1621
1625
1. Append |rule| to |routerRules|.
1622
1626
1. If |routerRules| [=list/contains=] a {{RouterRule}} whose {{RouterRule/source}} is either of "{{RouterSourceEnum/fetch-event}}" or "{{RouterSourceEnum/race-network-and-fetch-handler}}", and |serviceWorker|'s [=set of event types to handle=] does not [=set/contain=]{{ServiceWorkerGlobalScope/fetch!!event}}, return [=a promise rejected with=] a {{TypeError}}.
1627
+
1. If running the [=Check Router Registration Limit=] with |serviceWorker| returns false, return [=a promise rejected with=] a {{TypeError}}.
1623
1628
1. Set |serviceWorker|'s [=service worker/list of router rules=] to |routerRules|.
Note: To limit the resource usage and a condition evaluation time, |orConditions|'s [=list/size=] can be limited.
3410
3415
3411
3416
1. For each |orCondition| of |orConditions|:
3412
-
1. If running the [=Verify Router Condition=] algorithm with |orCondition| and |serviceWorker| returns false, return false.
3417
+
1. If running the [=Verify Router Condition=] algorithm with |orCondition| and |serviceWorker| and |registeredRuleCount| returns false, return false.
3413
3418
1. Set |hasCondition| to true.
3414
3419
1. If |condition|["{{RouterCondition/not}}"][=map/exists=], then:
3415
3420
1. If |hasCondition| is true, return false.
3416
3421
3417
3422
Note: For ease of understanding the router rule, the "not" condition is mutually exclusive with other conditions.
3418
3423
3419
-
1. If running the [=Verify Router Condition=] algorithm with |condition|["{{RouterCondition/not}}"] and |serviceWorker| returns false, return false.
3424
+
1. If running the [=Verify Router Condition=] algorithm with |condition|["{{RouterCondition/not}}"] and |serviceWorker| and |registeredRuleCount| returns false, return false.
3420
3425
1. Set |hasCondition| to true.
3421
3426
1. If |hasCondition| is true, then:
3422
3427
1. Increament |serviceWorker|'s [=service worker/router rule count=] by one.
1. Let |currentResult| be a [=count router condition result=].
3484
+
1. Set |currentResult|'s [=count router condition result/total count=] to 0.
3485
+
1. Set |currentResult|'s [=count router condition result/depth=] to 1.
3486
+
1. Let |maxRuleCount| be 1024.
3487
+
1. Let |maxDepth| be 10.
3488
+
1. [=list/For each=] |rule| of |serviceWorker|'s [=service worker/list of router rules=]:
3489
+
1. Set |result| to be the result of running [=Count Router Inner Conditions=] with |rule|["{{RouterRule/condition}}"], |currentResult|, |maxRuleCount|, and |maxDepth|.
1. Let |notCondition| be |condition|["{{RouterCondition/not}}"].
3519
+
1. Let |result| be the result of running [=Count Router Inner Conditions=] with |condition|["{{RouterCondition/not}}"], |result|, |maxCount|, and |maxDepth|.
0 commit comments