declarativeNetRequest.updateEnabledRulesets
Updates the extension's set of static rulesets. The rulesets with IDs listed in options.disableRulesetIds
are first deactivated, and then the rulesets listed in options.enableRulesetIds
are activated. Note that the set of enabled static rulesets persists across sessions but not across extension updates, i.e. the declarative_net_request.rule_resources
manifest key determines the set of enabled static rulesets on each extension update.
Note: In Firefox 132 and earlier, static rulesets don't load after a browser restart when there are no registered static or dynamic rules at install time (Firefox bug 1921353). A workaround is to make sure that the declarative_net_request
manifest key contains at least one enabled ruleset.
Syntax
let updatedRulesets = browser.declarativeNetRequest.updateEnabledRulesets(
options // object
);
Parameters
options
-
An object detailing the rulesets to activate or deactivate in the extension's static rulesets.
disableRulesetIds
Optional-
An array of
string
. IDs of static Rulesets to deactivated. enableRulesetIds
Optional-
An array of
string
. IDs of static Rulesets to activated.
Return value
A Promise
If the request was successful, the promise is fulfilled with no arguments. If the request fails, the promise is rejected with an error message.
Examples
Browser compatibility
BCD tables only load in the browser