Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "GoaBlockAD",
"version": "1.4.0",
"version": "1.4.1",
"description": "__MSG_extDescription__",
"default_locale": "en",
"permissions": [
Expand Down
7 changes: 6 additions & 1 deletion popup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Allow-list rules use dynamic ids from 20000 (DYNAMIC_ALLOW_START in background.js)
const ALLOW_RULE_MIN_ID = 20000;

document.addEventListener('DOMContentLoaded', () => {
const toggleProtection = document.getElementById('toggle-protection');
const toggleCosmetic = document.getElementById('toggle-cosmetic');
Expand Down Expand Up @@ -70,7 +73,9 @@ document.addEventListener('DOMContentLoaded', () => {
if (currentTabId !== null) {
try {
const { rulesMatchedInfo } = await chrome.declarativeNetRequest.getMatchedRules({ tabId: currentTabId });
blockedCount.textContent = rulesMatchedInfo.length.toLocaleString(uiLang);
// On an allowed site every request matches the allowAllRequests rule: those aren't blocks.
const blocked = rulesMatchedInfo.filter(m => !(m.rule.rulesetId === '_dynamic' && m.rule.ruleId >= ALLOW_RULE_MIN_ID));
blockedCount.textContent = blocked.length.toLocaleString(uiLang);
} catch (err) {
console.warn('getMatchedRules failed', err);
}
Expand Down