Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mv3): FF Browser Action #1275

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions add-on/src/lib/redirect-handler/blockOrObserve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ function validateIfRuleChanged (rule: browser.DeclarativeNetRequest.Rule): boole
* Clean up all the rules, when extension is disabled.
*/
export async function cleanupRules (resetInMemory: boolean = false): Promise<void> {
if (supportsBlock()) {
Copy link
Member

@lidel lidel Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: supportsBlock name is confusing: it does not check if runtime it supports blocking webRequest, it checks if declarativeNetRequest is supported.

@whizzzkid in spare time, mind changing this to be the opposite boolean with name supportsDeclarativeNetRequest to remove confusion? (we dont want future contributors to use this for checking if blocking API is present)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create a follow up.

return
}
const existingRules = await browser.declarativeNetRequest.getDynamicRules()
const existingRulesIds = existingRules.map(({ id }): number => id)
await browser.declarativeNetRequest.updateDynamicRules({ addRules: [], removeRuleIds: existingRulesIds })
Expand Down