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).
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.
12 const GUARANTEED_MINIMUM_STATIC_RULES = 30000;
15 * The maximum number of static Rulesets an extension can specify as part of
16 * the "rule_resources" manifest key.
18 * NOTE: this limit may be increased in the future, see https://github.com/w3c/webextensions/issues/318
20 const MAX_NUMBER_OF_STATIC_RULESETS = 50;
23 * The maximum number of static Rulesets an extension can enable at any one time.
25 * NOTE: this limit may be increased in the future, see https://github.com/w3c/webextensions/issues/318
27 const MAX_NUMBER_OF_ENABLED_STATIC_RULESETS = 10;
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.
34 * NOTE: this limit may be increased in the future, see https://github.com/w3c/webextensions/issues/319
36 const MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES = 5000;
39 * The maximum number of regular expression rules that an extension can add.
40 * Session, dynamic and static rules have their own quota.
42 * TODO bug 1821033: Bump limit after optimizing regexFilter.
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,