Skip to content

issue_674: how to debug rules in AdGuard for Chrome MV3 #700

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

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3f5d30e
issue_674: how to debug rules in AdGuard for Chrome MV3
105th May 27, 2025
34d3bda
Merge branch 'master' into fix/issue_674
el-termikael May 28, 2025
90caea3
fixes
105th May 28, 2025
c696d08
fix
105th May 29, 2025
af81fe7
fixed lint errors
105th May 29, 2025
ac9aa7c
Merge branch 'master' into fix/issue_674
el-termikael Jun 4, 2025
a6a6f5c
Add description for attributes without value in selector for html fil…
anyakushin Jan 16, 2025
097d427
Better English
anyakushin Jan 28, 2025
808fe8d
Specify minimal CoreLibs version supporting optional value in selector
anyakushin Jan 28, 2025
cb3ae52
Apply suggested
anyakushin Feb 19, 2025
9ee69db
describe the extension compatibility
slavaleleka Jun 5, 2025
5426a57
fix compatibility section grammar
slavaleleka Jun 5, 2025
b088420
automatically update translations
anyakushin Jun 6, 2025
ce27b6e
fix markdown in admonition
SeverAnna Jun 10, 2025
7db5331
update the info on how to block ads in Safari
SeverAnna Jun 9, 2025
9134692
Update instructions+add screenshot
SeverAnna Jun 10, 2025
b7036e8
fix trailing spaces
SeverAnna Jun 10, 2025
df48ef2
fix trailing spaces again
SeverAnna Jun 10, 2025
b2df373
fix ordered list
SeverAnna Jun 10, 2025
921d206
update the article How to create a dump
SeverAnna Jun 19, 2025
4051f65
fix capitalization
SeverAnna Jun 19, 2025
c10a2cd
Create usercripts-api.md
puglieri Jun 23, 2025
13b6e7e
Update usercripts-api.md
puglieri Jun 23, 2025
b8608b8
Update usercripts-api.md
puglieri Jun 23, 2025
6e64e8f
update userscripts-api.md
puglieri Jun 23, 2025
dc17f6f
update user-scrips-api.md
puglieri Jul 7, 2025
1f88600
Update rewards.md
EricZil May 24, 2025
1d4361c
remove *mobile_border in AGW articles
SeverAnna Jun 19, 2025
8ddfe17
fix typo
SeverAnna Jun 19, 2025
e41b803
change screenshots in extensions
SeverAnna Jun 19, 2025
bba5f8a
change screenshots in network
SeverAnna Jun 19, 2025
204d01f
update screenshots in other features
SeverAnna Jun 19, 2025
93455c5
Update settings.md
SeverAnna Jun 19, 2025
70675d4
fix links
SeverAnna Jun 19, 2025
2e1c082
fix links
SeverAnna Jun 19, 2025
5cc48ee
fix links again
SeverAnna Jun 19, 2025
6d91cd3
fix capitalization
SeverAnna Jun 19, 2025
5a3de6c
Update docs/adguard-for-windows/features/settings.md
SeverAnna Jun 20, 2025
d2b912e
small fixes
SeverAnna Jun 20, 2025
2361571
fix apostrophes and quotation marks
SeverAnna Jun 23, 2025
b40c1e7
update instructions and screenshots in the AGW installation article
SeverAnna Jun 18, 2025
3760065
remove old screenshots
SeverAnna Jun 23, 2025
02bf478
Update docs/adguard-for-windows/installation.md
SeverAnna Jun 23, 2025
dc32b16
Add info on updating third-party add-ons in FF browsers with HTTPS fi…
SeverAnna Jun 17, 2025
c6c9631
fix markdown
SeverAnna Jun 17, 2025
34931a0
automatically update translations
SeverAnna Jun 23, 2025
deea700
remove Restore VPN automatically
el-termikael Jun 24, 2025
d056c00
Update manual-certifcate.md + secure-folder.md
puglieri Jun 16, 2025
e2bb049
Update manual-certifcate.md + secure-folder.md
puglieri Jun 16, 2025
0178475
Update manual-certificate.md
puglieri Jun 17, 2025
bc4b12c
Fixes
puglieri Jun 17, 2025
884deca
Update docs/adguard-for-android/solving-problems/secure-folder.md
puglieri Jun 17, 2025
323c40e
Update manual-certificate.md
puglieri Jun 19, 2025
0c5926e
Update manual-certificate.md
puglieri Jun 19, 2025
e998409
Update docs/adguard-for-android/solving-problems/manual-certificate.md
puglieri Jun 23, 2025
66219f8
Update manual-certificate.md
puglieri Jun 24, 2025
1e2d7a5
[AGM-2542] Add wfpdiag.cab to crush dump manual
Jul 2, 2025
45e3269
Update docs/adguard-for-windows/solving-problems/dump-file.md
DashaBu Jul 2, 2025
d0be162
fixed the sentence about reproducing the problem
Jul 2, 2025
56c1f1b
Update docs/adguard-for-windows/solving-problems/dump-file.md
DashaBu Jul 3, 2025
1826746
Update docs/adguard-for-windows/solving-problems/dump-file.md
DashaBu Jul 3, 2025
f82af86
Update docs/adguard-for-windows/solving-problems/dump-file.md
DashaBu Jul 3, 2025
d904b61
Update docs/adguard-for-windows/solving-problems/dump-file.md
DashaBu Jul 3, 2025
e54a9ce
Update docs/adguard-for-windows/solving-problems/dump-file.md
DashaBu Jul 3, 2025
e0766da
fixed
Jul 3, 2025
7e6db73
automatically update translations
DashaBu Jul 3, 2025
ec32e40
Update screenshot
vbagirov Jul 4, 2025
8adfabf
Update user-scripts-api.md
puglieri Jul 7, 2025
133bcab
Update user-scripts-api.md
puglieri Jul 7, 2025
99b0ffb
Update docs/adguard-browser-extension/user-scripts-api.md
puglieri Jul 9, 2025
28d010e
Update docs/adguard-browser-extension/user-scripts-api.md
puglieri Jul 9, 2025
9b62ddd
Update docs/adguard-browser-extension/user-scripts-api.md
puglieri Jul 9, 2025
fd43a23
Update docs/adguard-browser-extension/user-scripts-api.md
puglieri Jul 9, 2025
c3ab855
Update docs/adguard-browser-extension/user-scripts-api.md
puglieri Jul 9, 2025
0e5f775
Update user-scripts-api.md
puglieri Jul 11, 2025
4468483
fix wording in Tracking filter rules stats
SeverAnna Jul 8, 2025
7dd0786
delete space
SeverAnna Jul 8, 2025
914a8fe
automatically update translations
vbagirov Jul 4, 2025
2bdc6f4
new description
105th Jul 15, 2025
4be3b33
Merge branch 'master' into fix/issue_674
105th Jul 15, 2025
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 docs/adguard-browser-extension/mv3-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The **MV3 version** has replaced our old extension in the [Chrome Web Store](htt

The **beta version of MV3** will still be available in the [Chrome Web Store](https://chromewebstore.google.com/detail/adguard-adblocker-mv3-exp/apjcbfpjihpedihablmalmbbhjpklbdf).

The old beta extension will be renamed to [**AdGuard Ad Blocker MV2**](https://chromewebstore.google.com/detail/adguard-adblocker-beta/gfggjaccafhcbfogfkogggoepomehbjl) and will be supported until Google phases it out.
The old beta extension has been renamed to [**AdGuard Ad Blocker MV2**](https://chromewebstore.google.com/detail/adguard-adblocker-beta/gfggjaccafhcbfogfkogggoepomehbjl) and may no longer be supported by Google.

## Main changes in features and settings

Expand Down
73 changes: 48 additions & 25 deletions docs/adguard-browser-extension/solving-problems/debug-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ In [AdGuard for Chrome MV3](/adguard-browser-extension/mv3-version), the Filteri

These instructions are also meant for problematic cases where you want to modify the rules that are bundled with the extension statically. In most cases, using *User rules* in the extension should be sufficient.

Additionally, you can edit filters and rebuild DNR rulesets without rebuilding the entire extension, which may be useful for debugging purposes.

## Prerequisites

1. **Git:** [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

1. **Node:** [Install Node.js](https://nodejs.org/en/download/package-manager)

1. **Yarn:** [Install Yarn](https://classic.yarnpkg.com/lang/en/docs/install)
1. **pnpm:** [Install pnpm](https://pnpm.io/installation)

## How to clone extension

Expand All @@ -29,30 +31,18 @@ These instructions are also meant for problematic cases where you want to modify
cd AdguardBrowserExtension
```

1. Switch to the `v5.0` branch:

```bash
git checkout v5.0
```

1. Install dependencies:

```bash
yarn install
pnpm install
```

## How to build extension

1. Switch to the `v5.0` branch:

```bash
git checkout v5.0
```

1. Run the following command in the terminal:

```bash
yarn dev chrome-mv3
pnpm dev chrome-mv3
```

1. The built extension will be located in the directory:
Expand All @@ -77,22 +67,55 @@ These instructions are also meant for problematic cases where you want to modify

That’s it!

## How to debug rules
##### How to debug rules

1. Find and modify the rule you need in the `./Extension/filters/chromium-mv3` directory in the `.txt` files.
You can debug and update DNR rulesets without rebuilding the entire extension. There are two main workflows:

1. Convert the rules from txt to declarative form:
**A. Automatic (recommended for most cases):**

```bash
yarn convert-declarative
1. **Build the extension** (if not done yet):
```shell
pnpm install
pnpm dev chrome-mv3
```

1. **Start watching for filter changes:**
```shell
pnpm debug-filters:watch
```
- This will extract text filters to `./build/dev/chrome-mv3/filters` and watch for changes.
- When you edit and save any filter file, DNR rulesets will be rebuilt automatically.

1. Build the extension again:
1. **Reload the extension in your browser** to apply new rulesets.

```bash
yarn dev chrome-mv3
**B. Manual (for advanced/manual control):**

1. **Build the extension** (if not done yet):
```shell
pnpm install
pnpm dev chrome-mv3
```

1. **Extract text filters:**
```shell
pnpm debug-filters:extract
```

1. **Edit the text filters** in `./build/dev/chrome-mv3/filters` as needed.

1. **Convert filters to DNR rulesets:**
```shell
pnpm debug-filters:convert
```

1. **Reload the extension in your browser** to apply new rulesets.

**Tip:**
- To download the latest available text filters, run:
```shell
pnpm debug-filters:load
```

1. Reload the extension in the browser:
If you see an exclamation mark in the filtering log, it means the assumed rule (calculated by the engine) and the applied rule (converted to DNR) are different. Otherwise, only the applied rule (in DNR and text ways) will be shown.

![Reload extension](https://cdn.adtidy.org/content/Kb/ad_blocker/browser_extension/reload_extension.png)
##### <a name="dev-technical-info-about-debug-commands"></a> Technical information about commands
Loading