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

Docs for MAX_NUMBER_OF_DISABLED_STATIC_RULES #34447

Merged

Conversation

rebloor
Copy link
Contributor

@rebloor rebloor commented Jun 27, 2024

Description

Adds documentation and release note for the declarativeNetRequest type MAX_NUMBER_OF_DISABLED_STATIC_RULES addressing the dev–doc-needed request from Bug 1896628 [DNR] Enforce a limit to the maximum number of static rules disabled individually.

Related issues and pull requests

BCD mdn/browser-compat-data#23533

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

github-actions bot commented Jun 27, 2024

Preview URLs (10 pages)
Flaws (3)

Note! 8 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_DISABLED_STATIC_RULES
Title: declarativeNetRequest.MAX_NUMBER_OF_DISABLED_STATIC_RULES
Flaw count: 1

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

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

(comment last updated: 2024-07-08 02:51:33)

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

github-actions bot commented Jul 1, 2024

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

@github-actions github-actions bot removed the merge conflicts 🚧 [PR only] label Jul 2, 2024
@rebloor rebloor requested a review from Rob--W July 2, 2024 10:31
Copy link
Contributor

github-actions bot commented Jul 4, 2024

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 Jul 4, 2024
@github-actions github-actions bot removed Content:Firefox Content in the Mozilla/Firefox subtree merge conflicts 🚧 [PR only] labels Jul 4, 2024
This limit is:

- in Firefox: `5000`
- in Chrome: `5000`
Copy link
Member

@Rob--W Rob--W Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Chrome the limit is across all static rulesets.

(In Firefox it is per ruleset)

@rpl Could you confirm that this is intentional? What should we document?

EDIT: I announced our behavior at w3c/webextensions#162 (comment)

@@ -7,7 +7,7 @@ browser-compat: webextensions.api.declarativeNetRequest.updateStaticRules

{{AddonSidebar}}

Modifies the enabled state of rules in a static ruleset.
Modifies the enabled state of rules in a static ruleset. The number of rules that can be disabled in a ruleset is limited to the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DISABLED_STATIC_RULES","MAX_NUMBER_OF_DISABLED_STATIC_RULES")}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon taking a closer look I noticed that limits are not well documented in the individual articles. Let's delete this part here, and append something like this at the end of the section:

The number of enabled and disabled rules is limited, as explained at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest#static_ruleset_limits

(Also do this at getAvailableStaticRuleCount and the other constants)

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 hopefully updated all the appropriate "other constants" and I've added the link to the manifest key where we had no particular comment about limits previously

@@ -104,6 +104,7 @@ An extension can:

- specify static rulesets as part of the [`"declarative_net_request"`](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/declarative_net_request) manifest key up to the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_STATIC_RULESETS","MAX_NUMBER_OF_STATIC_RULESETS")}}.
- enable static rulesets up to at least the value of {{WebExtAPIRef("declarativeNetRequest.GUARANTEED_MINIMUM_STATIC_RULES","GUARANTEED_MINIMUM_STATIC_RULES")}}, and the number of enabled static rulesets must not exceed the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_ENABLED_STATIC_RULESETS","MAX_NUMBER_OF_ENABLED_STATIC_RULESETS")}}. In addition, the number of rules in enabled static rulesets for all extensions must not exceed the global limit. Extensions shouldn't depend on the global limit having a specific value and should instead use {{WebExtAPIRef("declarativeNetRequest.getAvailableStaticRuleCount","getAvailableStaticRuleCount")}} to find the number of additional rules they can enable.
- disable rules in a static rulesets up to the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DISABLED_STATIC_RULES","MAX_NUMBER_OF_DISABLED_STATIC_RULES")}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- disable rules in a static rulesets up to the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DISABLED_STATIC_RULES","MAX_NUMBER_OF_DISABLED_STATIC_RULES")}}.
- disable rules in a static rulesets up to the value of {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DISABLED_STATIC_RULES","MAX_NUMBER_OF_DISABLED_STATIC_RULES")}}. Disabling individual rules does not increase the number of available static rules.

Maybe also link to the full explanation at w3c/webextensions#162 (comment)

(If you see a better way to describe what I wrote, please do so. It looks very subtle.)

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 I have rephrased this section, please take a look. In addition, given that we note that "the number of rules in enabled static rulesets for all extensions must not exceed the global limit," do we need to say something about what happens if someone tries to install an extension that (given other extensions they may have installed) exceeds that global limit?

Co-authored-by: Rob Wu <rob@robwu.nl>
@github-actions github-actions bot added size/s [PR only] 6-50 LoC changed and removed size/m [PR only] 51-500 LoC changed labels Jul 5, 2024
@rebloor rebloor requested a review from Rob--W July 5, 2024 18:51
@github-actions github-actions bot added Content:Firefox Content in the Mozilla/Firefox subtree size/m [PR only] 51-500 LoC changed and removed size/s [PR only] 6-50 LoC changed labels Jul 8, 2024
Co-authored-by: Rob Wu <rob@robwu.nl>
@rebloor rebloor merged commit 39a2c86 into mdn:main Jul 8, 2024
8 checks passed
@rebloor rebloor deleted the docs-for-MAX_NUMBER_OF_DISABLED_STATIC_RULES branch July 8, 2024 02:54
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants