Bug 1871127 - Add tsconfig, basic types, and fix or ignore remaining type errors...
[gecko.git] / toolkit / components / extensions / ExtensionDNRLimits.sys.mjs
blobac4cd79c44a75041c701e8a55d4ceaeaf8d88a5d
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 // TODO(Bug 1803370): consider allowing changing DNR limits through about:config prefs).
7 /**
8  * The minimum number of static rules guaranteed to an extension across its
9  * enabled static rulesets. Any rules above this limit will count towards the
10  * global static rule limit.
11  */
12 const GUARANTEED_MINIMUM_STATIC_RULES = 30000;
14 /**
15  * The maximum number of static Rulesets an extension can specify as part of
16  * the "rule_resources" manifest key.
17  *
18  * NOTE: this limit may be increased in the future, see https://github.com/w3c/webextensions/issues/318
19  */
20 const MAX_NUMBER_OF_STATIC_RULESETS = 50;
22 /**
23  * The maximum number of static Rulesets an extension can enable at any one time.
24  *
25  * NOTE: this limit may be increased in the future, see https://github.com/w3c/webextensions/issues/318
26  */
27 const MAX_NUMBER_OF_ENABLED_STATIC_RULESETS = 10;
29 /**
30  * The maximum number of dynamic and session rules an extension can add.
31  * NOTE: in the Firefox we are enforcing this limit to the session and dynamic rules count separately,
32  * instead of enforcing it to the rules count for both combined as the Chrome implementation does.
33  *
34  * NOTE: this limit may be increased in the future, see https://github.com/w3c/webextensions/issues/319
35  */
36 const MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES = 5000;
38 /**
39  * The maximum number of regular expression rules that an extension can add.
40  * Session, dynamic and static rules have their own quota.
41  *
42  * TODO bug 1821033: Bump limit after optimizing regexFilter.
43  */
44 const MAX_NUMBER_OF_REGEX_RULES = 1000;
46 // TODO(Bug 1803370): allow extension to exceed the GUARANTEED_MINIMUM_STATIC_RULES limit.
48 // The maximum number of static rules exceeding the per-extension
49 // GUARANTEED_MINIMUM_STATIC_RULES across every extensions.
51 // const MAX_GLOBAL_NUMBER_OF_STATIC_RULES = 300000;
53 export const ExtensionDNRLimits = {
54   GUARANTEED_MINIMUM_STATIC_RULES,
55   MAX_NUMBER_OF_STATIC_RULESETS,
56   MAX_NUMBER_OF_ENABLED_STATIC_RULESETS,
57   MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES,
58   MAX_NUMBER_OF_REGEX_RULES,