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

Add declarativeNetRequest #22644

Merged
merged 43 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
59611bd
Add declarativeNetRequest
rebloor Nov 30, 2022
b73189a
Added properties
rebloor Dec 2, 2022
0aef595
Add functions and events
rebloor Dec 5, 2022
d5750c5
Added manifest and permissions details
rebloor Dec 6, 2022
1005f78
Added API narrative + corrections
rebloor Dec 8, 2022
fd67a1e
Function > Method, deleted unused DomainType
rebloor Dec 8, 2022
6f75ef7
Merge branch 'main' into add-declarativeNetRequest
rebloor Dec 8, 2022
ac598a6
Suggestions from review
rebloor Dec 9, 2022
1b0d933
Removed references to MV3 and source boilerplate note
rebloor Dec 9, 2022
4b60d4e
Minor feedback updates
rebloor Dec 9, 2022
a8e4706
Dropping RequestMethod
rebloor Dec 9, 2022
d0a72a4
UpdateRuleOptions moved to updateDynamicRules and updateSessionRules
rebloor Dec 9, 2022
eef29ca
Merge branch 'main' into add-declarativeNetRequest
rebloor Dec 9, 2022
75928fc
correct folder name
rebloor Dec 9, 2022
47195a4
Merge branch 'main' into add-declarativeNetRequest
rebloor Dec 12, 2022
61d5928
testing + rule scope clarifications
rebloor Dec 12, 2022
fa603c0
Merge branch 'main' into add-declarativeNetRequest
rebloor Dec 13, 2022
4ea4944
nested type to additional object
rebloor Dec 15, 2022
c9fec37
Suggestions from review
rebloor Jan 25, 2023
1ad44ac
Deleted redundant files
rebloor Jan 26, 2023
e20426f
Tweaks to rules content
rebloor Jan 26, 2023
c18b1e8
Added extensionId to MatchedRule
rebloor Jan 27, 2023
2966fcf
Suggestions from review
rebloor Jan 30, 2023
d91086d
Added `options` & `includeOtherExtensions` to `testMatchOutcome`
rebloor Jan 30, 2023
346a58f
Merge branch 'main' into add-declarativeNetRequest
rebloor Feb 1, 2023
2133a45
Fix markdown issues
rebloor Feb 1, 2023
aac62de
Enable testing details links
rebloor Feb 1, 2023
453b060
RuleCondition feedback
rebloor Feb 1, 2023
75a53f3
Added details of types to ResourceType
rebloor Feb 1, 2023
15552f0
MatchedRule.rulesetId return value clarification
rebloor Feb 1, 2023
e52fd1d
Removed xbl from ResourceType in webRequest & declarativeNetRequest
rebloor Feb 3, 2023
d36fb76
Moved modify header precedence details
rebloor Feb 5, 2023
3769bbd
Apply suggestions from review
rebloor Feb 6, 2023
415f04f
Merge branch 'main' into add-declarativeNetRequest
rebloor Feb 6, 2023
524c495
Correct list markdown
rebloor Feb 7, 2023
dc0e5c5
Note about ModifyHeaderInfo.operation limitations
rebloor Feb 8, 2023
b6a0f4b
ModifyHeaderInfo BCD added to RuleAction
rebloor Feb 8, 2023
b236295
typo `redirect` to `responseHeaders`
rebloor Feb 10, 2023
a70ccae
Apply suggestions from review
rebloor Feb 10, 2023
2789805
BCD for ModifyHeaderInfo represented by RuleAction.requestHeaders & R…
rebloor Feb 12, 2023
98c2f98
Merge branch 'main' into add-declarativeNetRequest
rebloor Feb 12, 2023
7173fd6
Apply suggestions from review
rebloor Feb 12, 2023
3f5d857
Testing required preference comment
rebloor Feb 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from review
Co-authored-by: Rob Wu <[email protected]>
  • Loading branch information
rebloor and Rob--W committed Feb 12, 2023
commit 7173fd62d14623a746f1f2a6d7fb4acc1cdbddb1
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ The number of dynamic and session-scoped rules an extension can add is limited t

When the browser evaluates how to handle requests, it checks each extension's rules that have a condition that matches the request and chooses the one to consider applying as follows:

1. the rule priority, where 1 is the highest priority (and rules default to 1 where priority is not set)
1. the rule priority, where 1 is the lowest priority (and rules default to 1 where priority is not set)
If this doesn't result in one rule to apply:
2. the rule action, in the following order of precedence:
1. "allow" which means any other remaining rules are ignored.
Expand Down Expand Up @@ -165,7 +165,7 @@ If the request was not blocked or redirected, the matching `modifyHeaders` actio
- {{WebExtAPIRef("declarativeNetRequest.ResourceType")}}
- : The resource type of a request.
- {{WebExtAPIRef("declarativeNetRequest.Rule")}}
- : An object containing details of a dynamic rule.
- : An object containing details of a rule.
- {{WebExtAPIRef("declarativeNetRequest.RuleAction")}}
- : An object defining the action to take if a rule is matched.
- {{WebExtAPIRef("declarativeNetRequest.RuleCondition")}}
Expand All @@ -186,11 +186,11 @@ If the request was not blocked or redirected, the matching `modifyHeaders` actio
- {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES")}}
- : The maximum number of combined dynamic and session scoped rules an extension can add.
- {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_ENABLED_STATIC_RULESETS")}}
- : The maximum number of static `Rulesets` an extension can enable.
- : The maximum number of static rulesets an extension can enable.
- {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_REGEX_RULES")}}
- : The maximum number of regular expression rules that an extension can add.
- {{WebExtAPIRef("declarativeNetRequest.MAX_NUMBER_OF_STATIC_RULESETS")}}
- : The maximum number of static `Rulesets` an extension can specify as part of the [`"rule_resources"`](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/rule_resources) manifest key.
- : The maximum number of static rulesets an extension can specify as part of the [`declarative_net_request.rule_resources`](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/declarative_net_request) manifest key.
- {{WebExtAPIRef("declarativeNetRequest.SESSION_RULESET_ID")}}
- : The ruleset ID for the session-scoped rules added by the extension.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Checks if a regular expression is supported as a {{WebExtAPIRef("declarativeNetR

```js-nolint
let count = browser.declarativeNetRequest.isRegexSupported(
RegexOptions // object
regexOptions // object
);
```

### Parameters

- `RegexOptions`
- `regexOptions`

- : An object containing the regular expression to check.
- `isCaseSensitive` {{optional_inline}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ browser-compat: webextensions.api.declarativeNetRequest.MAX_NUMBER_OF_ENABLED_ST

The maximum number of static rulesets an extension can have enabled, i.e., the number of values in the [`declarative_net_request.rule_resources`](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/declarative_net_request) manifest key with `"enabled"` set to `true`. Static rulesets exceeding the limit are ignored.

An extension can change the number of enabled rulesets using the {{WebExtAPIRef("declarativeNetRequest.updateEnabledRulesets", "updateEnabledRulesets"}} method.
An extension can change the number of enabled rulesets using the {{WebExtAPIRef("declarativeNetRequest.updateEnabledRulesets", "updateEnabledRulesets")}} method.

Its value is `10`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ browser-compat: webextensions.api.declarativeNetRequest.MAX_NUMBER_OF_STATIC_RUL

{{AddonSidebar()}}

The maximum number of static rulesets an extension can specify as part of the [`"rule_resources"`](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/declarative_net_request) manifest key.
The maximum number of static rulesets an extension can specify as part of the [`declarative_net_request.rule_resources`](/docs/Mozilla/Add-ons/WebExtensions/manifest.json/declarative_net_request) manifest key.

Its value is `50`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ Events have three functions:
- `tabId`
- : A `number`. The ID of the tab in which the request takes place. Set to `-1` if the request is not related to a tab.
- `type`
- : [`ResourceType`](/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/ResourceType). The resource type of the request.
- : {{WebExtAPIRef("declarativeNetRequest.ResourceType", "ResourceType")}}. The resource type of the request.
- `url`
- : A `string`. The URL of the request.

- `rule`
- : [`MatchedRule`](/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/MatchedRule). Details of a matched rule.
- : {{WebExtAPIRef("declarativeNetRequest.MatchedRule", "MatchedRule")}}. Details of a matched rule.

{{WebExtExamples}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ Configures whether the action count for tabs is displayed as the extension actio
## Syntax

```js-nolint
let count = browser.declarativeNetRequest.setExtensionActionOptions();
let count = browser.declarativeNetRequest.setExtensionActionOptions(
extensionActionOptions, // object
);
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let result = await browser.declarativeNetRequest.testMatchOutcome(
- `url`
- : A `string`. The URL of the hypothetical request.

- `options`
- `options` {{optional_inline}}

- : Details of options for the request.
- `includeOtherExtensions` {{optional_inline}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ browser-compat: webextensions.api.declarativeNetRequest.updateDynamicRules

{{AddonSidebar()}}

Modifies the set of dynamic rules for the extension. The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. Note that:
Modifies the set of dynamic rules for the extension. The rules with IDs listed in `options.removeRuleIds` are first removed, and then the rules given in `options.addRules` are added. Note that:

- 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ These are the `manifest.json` keys; these keys are available in Manifest V2 and
- [optional_permissions](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/optional_permissions)
- [options_page](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/options_page)
- [options_ui](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/options_ui)
- [page_action](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/page_action) (Manifest V2 only)
- [page_action](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/page_action) (Manifest V2 only in Chrome)
- [permissions](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/permissions)
- [protocol_handlers](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/protocol_handlers)
- [short_name](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/short_name)
Expand Down