-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add declarativeNetRequest * Added properties * Add functions and events * Added manifest and permissions details * Added API narrative + corrections * Function > Method, deleted unused DomainType * Suggestions from review Co-authored-by: Rob Wu <rob@robwu.nl> * Removed references to MV3 and source boilerplate note * Minor feedback updates * Dropping RequestMethod * UpdateRuleOptions moved to updateDynamicRules and updateSessionRules * correct folder name * testing + rule scope clarifications * nested type to additional object * Suggestions from review Co-authored-by: Rob Wu <rob@robwu.nl> * Deleted redundant files * Tweaks to rules content * Added extensionId to MatchedRule * Suggestions from review Co-authored-by: Rob Wu <rob@robwu.nl> * Added `options` & `includeOtherExtensions` to `testMatchOutcome` * Fix markdown issues * Enable testing details links * RuleCondition feedback * Added details of types to ResourceType * MatchedRule.rulesetId return value clarification * Removed xbl from ResourceType in webRequest & declarativeNetRequest * Moved modify header precedence details * Apply suggestions from review Co-authored-by: Rob Wu <rob@robwu.nl> * Correct list markdown * Note about ModifyHeaderInfo.operation limitations * ModifyHeaderInfo BCD added to RuleAction * typo `redirect` to `responseHeaders` * Apply suggestions from review Co-authored-by: Rob Wu <rob@robwu.nl> * BCD for ModifyHeaderInfo represented by RuleAction.requestHeaders & RuleAction.responseHeaders Corrected markdown issues in ModifyHeaderInfo * Apply suggestions from review Co-authored-by: Rob Wu <rob@robwu.nl> * Testing required preference comment --------- Co-authored-by: Rob Wu <rob@robwu.nl>
- Loading branch information
Showing
34 changed files
with
2,592 additions
and
41 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...lla/add-ons/webextensions/api/declarativenetrequest/dynamic_ruleset_id/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: declarativeNetRequest.DYNAMIC_RULESET_ID | ||
slug: Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/DYNAMIC_RULESET_ID | ||
tags: | ||
- DYNAMIC_RULESET_ID | ||
- API | ||
- Add-ons | ||
- Extensions | ||
- Reference | ||
- WebExtensions | ||
- Property | ||
- declarativeNetRequest | ||
- DYNAMIC_RULESET_ID | ||
browser-compat: webextensions.api.declarativeNetRequest.DYNAMIC_RULESET_ID | ||
--- | ||
|
||
{{AddonSidebar()}} | ||
|
||
Ruleset ID for the dynamic rules added by the extension using {{WebExtAPIRef("declarativeNetRequest.updateDynamicRules","updateDynamicRules")}}. | ||
|
||
Its value is `"_dynamic"`. | ||
|
||
{{WebExtExamples}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
<!-- | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
--> |
70 changes: 70 additions & 0 deletions
70
...ns/webextensions/api/declarativenetrequest/getavailablestaticrulecount/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: declarativeNetRequest.getAvailableStaticRuleCount | ||
slug: Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/getAvailableStaticRuleCount | ||
tags: | ||
- API | ||
- Add-ons | ||
- Extensions | ||
- Reference | ||
- WebExtensions | ||
- Method | ||
- declarativeNetRequest | ||
- getAvailableStaticRuleCount | ||
browser-compat: webextensions.api.declarativeNetRequest.getAvailableStaticRuleCount | ||
--- | ||
|
||
{{AddonSidebar()}} | ||
|
||
Returns the number of static rules that can be activated before the global static rule limit is reached. | ||
|
||
## Syntax | ||
|
||
```js-nolint | ||
let count = await browser.declarativeNetRequest.getAvailableStaticRuleCount(); | ||
``` | ||
|
||
### Parameters | ||
|
||
This function takes no parameters. | ||
|
||
### Return value | ||
|
||
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) fulfilled with a number that indicates how many static rules can enable before the global static rule limit is reached. If the request fails, the promise is rejected with an error message. | ||
|
||
## Examples | ||
|
||
{{WebExtExamples}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
<!-- | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
--> |
70 changes: 70 additions & 0 deletions
70
...ozilla/add-ons/webextensions/api/declarativenetrequest/getdynamicrules/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: declarativeNetRequest.getAvailableStaticRuleCount | ||
slug: Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/getDynamicRules | ||
tags: | ||
- API | ||
- Add-ons | ||
- Extensions | ||
- Reference | ||
- WebExtensions | ||
- Method | ||
- declarativeNetRequest | ||
- getDynamicRules | ||
browser-compat: webextensions.api.declarativeNetRequest.getDynamicRules | ||
--- | ||
|
||
{{AddonSidebar()}} | ||
|
||
Returns the set of dynamic rules for the extension. | ||
|
||
## Syntax | ||
|
||
```js-nolint | ||
let gettingDynamicRules = browser.declarativeNetRequest.getDynamicRules(); | ||
``` | ||
|
||
### Parameters | ||
|
||
This function takes no parameters. | ||
|
||
### Return value | ||
|
||
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) is fulfilled with an array of {{WebExtAPIRef("declarativeNetRequest.Rule")}} objects. Each of these represents a rule that belongs to the extension. If no rules are active, the array is empty. If the request fails, the promise is rejected with an error message. | ||
|
||
## Examples | ||
|
||
{{WebExtExamples}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
<!-- | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
--> |
70 changes: 70 additions & 0 deletions
70
...lla/add-ons/webextensions/api/declarativenetrequest/getenabledrulesets/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: declarativeNetRequest.getEnabledRulesets | ||
slug: Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/getEnabledRulesets | ||
tags: | ||
- API | ||
- Add-ons | ||
- Extensions | ||
- Reference | ||
- WebExtensions | ||
- Method | ||
- declarativeNetRequest | ||
- getEnabledRulesets | ||
browser-compat: webextensions.api.declarativeNetRequest.getEnabledRulesets | ||
--- | ||
|
||
{{AddonSidebar()}} | ||
|
||
Returns the IDs for the set of activated static rulesets. | ||
|
||
## Syntax | ||
|
||
```js-nolint | ||
let rulesetIds = await browser.declarativeNetRequest.getEnabledRulesets(); | ||
``` | ||
|
||
### Parameters | ||
|
||
This function takes no parameters. | ||
|
||
### Return value | ||
|
||
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) fulfilled with an array of string containing static rulesets IDs. If no rules are active, the array is empty. If the request fails, the promise is rejected with an error message. | ||
|
||
## Examples | ||
|
||
{{WebExtExamples}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
<!-- | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
--> |
87 changes: 87 additions & 0 deletions
87
...ozilla/add-ons/webextensions/api/declarativenetrequest/getmatchedrules/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
title: declarativeNetRequest.getMatchedRules | ||
slug: Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/getMatchedRules | ||
tags: | ||
- API | ||
- Add-ons | ||
- Extensions | ||
- Reference | ||
- WebExtensions | ||
- Method | ||
- declarativeNetRequest | ||
- getMatchedRules | ||
browser-compat: webextensions.api.declarativeNetRequest.getMatchedRules | ||
--- | ||
|
||
{{AddonSidebar()}} | ||
|
||
Returns all the rules matched for the extension. Callers can filter the list of matched rules by specifying a `filter`. This method is only available to extensions with the `"declarativeNetRequestFeedback"` permission or that have the `"activeTab"` permission granted for the `tabId` specified in `filter`. Rules not associated with an active document that were matched more than five minutes ago are returned. | ||
|
||
## Syntax | ||
|
||
```js-nolint | ||
let gettingMatchedRules = browser.declarativeNetRequest.getMatchedRules( | ||
filter // object | ||
); | ||
``` | ||
|
||
### Parameters | ||
|
||
- `filter` {{optional_inline}} | ||
|
||
- : An object to filter the list of matched rules. | ||
- `minTimeStamp` {{optional_inline}} | ||
- : A `number`. If specified, only matches rules after the specified timestamp. | ||
- `tabId` {{optional_inline}} | ||
- : A `number`. If specified, only matches rules for the specified tab. Matches rules not associated with any active tab if set to `-1`. | ||
|
||
### Return value | ||
|
||
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that fulfills with an object with these properties: | ||
|
||
- `rule` | ||
- : {{WebExtAPIRef("declarativeNetRequest.MatchedRule")}}. Details of a matched rule. | ||
- `tabId` | ||
- : `number` The `tabId` of the tab the request originated from if the tab is still active. Otherwise, `-1`. | ||
- `timeStamp` | ||
- : `number` The time the rule was matched. Timestamps correspond to the Javascript convention for times, i.e. the number of milliseconds since the epoch. | ||
|
||
If no rules are matched, the object is empty. If the request fail, the promise is rejected with an error message | ||
|
||
## Examples | ||
|
||
{{WebExtExamples}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
<!-- | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
--> |
Oops, something went wrong.