Skip to content

Commit

Permalink
chore: generate declarativeNetRequest rule id
Browse files Browse the repository at this point in the history
  • Loading branch information
dessant committed Jun 20, 2024
1 parent 7b44705 commit 18383e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
processAppUse,
setAppVersion,
getStartupState,
getNetRequestRuleIds,
isContextMenuSupported,
checkSearchEngineAccess,
getEngineMenuIcon,
Expand Down Expand Up @@ -52,10 +53,13 @@ const queue = new Queue({concurrency: 1});

async function setUserAgentHeader(tabId, userAgent) {
if (mv3) {
const ruleIds = getNetRequestRuleIds();

await browser.declarativeNetRequest.updateSessionRules({
removeRuleIds: ruleIds,
addRules: [
{
id: tabId,
id: ruleIds[0],
action: {
type: 'modifyHeaders',
requestHeaders: [
Expand Down

0 comments on commit 18383e9

Please sign in to comment.