declarativeNetRequest.updateEnabledRulesets

更新扩展的静态规则集。首先禁用 options.disableRulesetIds 中列出的规则集,然后激活 options.enableRulesetIds 中列出的规则集。请注意,启用的静态规则集的集合会跨会话保留,但不会跨扩展更新保留,即每次扩展更新时,declarative_net_request.rule_resources 清单键决定了启用的静态规则集的集合。

语法

js
let updatedRulesets = browser.declarativeNetRequest.updateEnabledRulesets(
    options                // 对象
);

参数

options

一个详细说明扩展的静态规则集中要激活或禁用的规则集的对象。

disableRulesetIds 可选

一个 string 数组。要禁用的静态规则集的 ID。

enableRulesetIds 可选

一个 string 数组。要激活的静态规则集的 ID。

返回值

一个 Promise。如果请求成功,其会被兑现且不带参数。如果请求失败,则 promise 将被拒绝并带有错误消息。

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
updateEnabledRulesets

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support