Skip to content
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

Merged
merged 11 commits into from
Jul 13, 2024
Merged

New DNR properties #34214

merged 11 commits into from
Jul 13, 2024

Conversation

rebloor
Copy link
Contributor

@rebloor rebloor commented Jun 17, 2024

Description

Summary

Adds and updates documentation in support of Bug 1894128
[DNR] Replace MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES including:

  • release note
  • new pages for MAX_NUMBER_OF_DYNAMIC_RULES and MAX_NUMBER_OF_SESSION_RULES
  • relevant update where MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES is mentioned

Related issues and pull requests

BCD changes in mdn/browser-compat-data#23400

@rebloor rebloor added the Content:WebExt WebExtensions docs label Jun 17, 2024
@rebloor rebloor requested a review from dotproto June 17, 2024 02:47
@rebloor rebloor self-assigned this Jun 17, 2024
@rebloor rebloor requested review from a team as code owners June 17, 2024 02:47
@rebloor rebloor requested review from pepelsbey and removed request for a team June 17, 2024 02:47
@github-actions github-actions bot added Content:Firefox Content in the Mozilla/Firefox subtree size/m [PR only] 51-500 LoC changed labels Jun 17, 2024
Copy link
Contributor

github-actions bot commented Jun 17, 2024

Preview URLs (9 pages)
Flaws (4)

Note! 6 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Mozilla/Firefox/Releases/128
Title: Firefox 128 for developers
Flaw count: 2

  • macros:
    • /en-US/docs/Web/API/MediaKeys/getStatusForPolicy does not exist
  • broken_links:
    • Can't resolve /en-US/docs/Web/HTTP/Headers/Priority

URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/MAX_NUMBER_OF_DYNAMIC_RULES
Title: declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_RULES
Flaw count: 1

  • bad_bcd_queries:
    • No BCD data for query: webextensions.api.declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_RULES

URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/MAX_NUMBER_OF_SESSION_RULES
Title: declarativeNetRequest.MAX_NUMBER_OF_SESSION_RULES
Flaw count: 1

  • bad_bcd_queries:
    • No BCD data for query: webextensions.api.declarativeNetRequest.MAX_NUMBER_OF_SESSION_RULES
External URLs (2)

URL: /en-US/docs/Mozilla/Firefox/Releases/128
Title: Firefox 128 for developers


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES
Title: declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES

(comment last updated: 2024-07-10 04:16:17)

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")}}.
Copy link
Collaborator

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.

@dotproto
Copy link
Collaborator

I also just realized that MAX_NUMBER_OF_UNSAFE_SESSION_RULES and MAX_NUMBER_OF_UNSAFE_DYNAMIC_RULES aren't included in this PR. Even though they're only supported by Chromium. We should probably cover them even though they're only supported by Chrome.

@rebloor
Copy link
Contributor Author

rebloor commented Jun 18, 2024

I also just realized that MAX_NUMBER_OF_UNSAFE_SESSION_RULES and MAX_NUMBER_OF_UNSAFE_DYNAMIC_RULES aren't included in this PR. Even though they're only supported by Chromium. We should probably cover them even though they're only supported by Chrome.

@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.

rebloor and others added 2 commits June 18, 2024 14:57
Co-authored-by: Simeon Vincent <svincent@gmail.com>
Copy link
Member

@pepelsbey pepelsbey left a 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!

files/en-us/mozilla/firefox/releases/128/index.md Outdated Show resolved Hide resolved
rebloor and others added 2 commits June 22, 2024 05:34
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label Jun 26, 2024
@github-actions github-actions bot removed the merge conflicts 🚧 [PR only] label Jun 26, 2024
@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label Jul 8, 2024
Copy link
Contributor

github-actions bot commented Jul 8, 2024

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.
Copy link
Member

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.
Copy link
Member

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

Copy link
Contributor Author

@rebloor rebloor Jul 8, 2024

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?

Copy link
Member

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.

Copy link
Contributor Author

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.
Copy link

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.

Copy link
Member

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.

@github-actions github-actions bot removed the merge conflicts 🚧 [PR only] label Jul 9, 2024
@rebloor rebloor requested a review from Rob--W July 11, 2024 02:16
@rebloor rebloor merged commit 787fd07 into mdn:main Jul 13, 2024
8 checks passed
@rebloor rebloor deleted the DNR-properties branch July 13, 2024 17:20
rebloor added a commit to mdn/browser-compat-data that referenced this pull request Jul 13, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Firefox Content in the Mozilla/Firefox subtree Content:WebExt WebExtensions docs size/m [PR only] 51-500 LoC changed
5 participants