-
Notifications
You must be signed in to change notification settings - Fork 22.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New DNR properties #34214
New DNR properties #34214
Conversation
...mozilla/add-ons/webextensions/api/declarativenetrequest/max_number_of_dynamic_rules/index.md
Outdated
Show resolved
Hide resolved
...mozilla/add-ons/webextensions/api/declarativenetrequest/max_number_of_session_rules/index.md
Outdated
Show resolved
Hide resolved
The number of dynamic and session-scoped rules an extension can add is limited to the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES","MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES")}}. | ||
The number of dynamic and session-scoped rules an extension can add is limited to: | ||
|
||
- Up to Chrome 119 and Firefox 127, the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES","MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES")}}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention here (and in other similar text on other pages) that this value is also used in Safari? It appears that they have a 30,000 rule limit.
I also just realized that |
@dotproto Sorry, I should've included my note from the BCD here also i.e. MAX_NUMBER_OF_UNSAFE_DYNAMIC_RULES and MAX_NUMBER_OF_UNSAFE_SESSION_RULES - new entries, excluding documentation links as these haven't been implemented in Firefox yet (to be implemented in bug 1894119) I've done this because there have been some comments made in the past about potential problems of including documentation for features not included in Firefox. |
Co-authored-by: Simeon Vincent <svincent@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from the editorial perspective. Thanks!
Co-authored-by: Vadim Makeev <hi@pepelsbey.dev>
This pull request has merge conflicts that must be resolved before it can be merged. |
This pull request has merge conflicts that must be resolved before it can be merged. |
@@ -12,7 +12,9 @@ Modifies the set of dynamic rules for the extension. The rules with IDs listed i | |||
- This update happens as an atomic operation: either all specified rules are added and removed, or an error is returned. | |||
- These rules are persisted across browser sessions and across extension updates. | |||
- Static rules specified as part of the extension package can not be removed using this function. | |||
- {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES")}} is the maximum number of dynamic and session rules an extension can add. | |||
- The number of rules that can be added is limited: | |||
- In Safari and up to Chrome 119 and Firefox 127, to the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES","MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES")}} for the combined total of dynamic and session-scoped rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Firefox and Safari, the quotas have always been separate, never together. This feedback also applies to the other part of your PR.
|
||
In Firefox, each ruleset has its own quota. | ||
In Chrome and Safari, this limit is enforced for the combined total of dynamic and session-scoped rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Chrome this was only combined until 119, from 120 they are separate (and that is why the constant was deprecated in Chrome). https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#session-rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rob--W I've added a clarification to the comment about the deprecation. However, wouldn't it be most accurate to say that the property is deprecated and the limit superseded, given the limit here is 30,000 but the limits on the separate properties are 30,00 and 5000 which presumably means that from 120 rather than a combined 30,000 dynamic and session rules you can now set up 35,000 e.g. 30000+5000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rob--W I've added a clarification to the comment about the deprecation. However, wouldn't it be most accurate to say that the property is deprecated and the limit superseded, given the limit here is 30,000 but the limits on the separate properties are 30,00 and 5000 which presumably means that from 120 rather than a combined 30,000 dynamic and session rules you can now set up 35,000 e.g. 30000+5000?
If all requirements have been met, then an extension in Chrome 120+ can have 5000 session rules (like Firefox) and 30000 safe dynamic rules. The max number of dynamic rules in Chrome is 30000, but that is limited to "safe" rules (https://developer.chrome.com/docs/extensions/reference/api/declarativeNetRequest#safe_rules) a concept that Firefox hasn't implemented yet. If an extension wants other kinds of rules, such as redirect rules, then they are bound to MAX_NUMBER_OF_UNSAFE_DYNAMIC_RULES, capped at 5000.
So if an extension wants to have many redirect (or modifyHeaders) rules, they can have at most 5000+5000 dynamic and session rules, combined 10000. Combined means that the individual quotas have to be maximized, it is not possible to have 4999 session rules and 5001 ("unsafe") dynamic rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rob--W does this get any closer to the reality of what MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES means/ment:
- until Firefox 126, this property had a value of 5000 and indicated that an extension could create up to 5000 dynamic rules and up to 5000 session-scope rules. This property was deprecated in Firefox 126, and the limits are now defined separately for each rule type by MAX_NUMBER_OF_DYNAMIC_RULES and MAX_NUMBER_OF_SESSION_RULES.
- until Chrome 119, this property had a value of 30,000 and indicated that an extension could create any combination of dynamic and session-scope up to 30,000. This property was deprecated in Chrome 120. See rule limits in the Chrome documentation for information on limits in Chrome 120 and higher.
- in Safari, this property has a value of 30,000 ad indicates an extension can create any combination of dynamic and session-scope rules up to 30,000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct for Safari.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost correct - until Chrome 119 the limit was 5000.
* DNR properties changes * Note re-chrome deprecation of MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES * Additional notes Merged with failing Active LTS due to the absence of MDN pages added with mdn/content#34214
Description
Summary
Adds and updates documentation in support of Bug 1894128
[DNR] Replace MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES including:
Related issues and pull requests
BCD changes in mdn/browser-compat-data#23400