Помогите пожалуйста, что тут не так? Не могу понять, что не правильно :/
Ошибка:
Error in event handler: TypeError: Error in invocation of declarativeNetRequest.updateDynamicRules(declarativeNetRequest.UpdateRuleOptions options, optional function callback): Error at parameter 'options': Error at property 'addRules': Error at index 0: Error at property 'action': Error at property 'responseHeaders': Error at index 0: Error at property 'operation': Value must be one of append, remove, set.
Код:
const { runtime, declarativeNetRequest } = require("webextension-polyfill");
const rule = {
id: 1,
condition: {
urlFilter: "site.ru/*",
resourceTypes: ["main_frame", "sub_frame", "xmlhttprequest"]
},
action: {
type: "modifyHeaders",
responseHeaders: [
{
operation: "removeHeaders",
headerNames: [
"content-security-policy",
"x-content-security-policy",
"x-frame-options"
]
},
{
operation: "setHeaders",
headers: [
{ name: "Access-Control-Allow-Origin", value: "*" }
]
}
]
}
};
runtime.onInstalled.addListener(() => {
declarativeNetRequest.updateDynamicRules({
addRules: [rule],
removeRuleIds: [1]
});
});