Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Testing ad block rule changes in Brave

Brian R. Bondy edited this page Apr 2, 2019 · 7 revisions

Testing ad block rule changes

On 0.65.x and later, you can go to about:adblock where you can put manual ABP filters now. 1 per line.

Alternate way

  1. Clone brave/ad-block
  2. Clone brave/adblock-lists
  3. In your local brave/adblock-lists repository, git checkout -b YOUR_BRANCH_NAME to make a branch
  4. Make all your changes in your branch—probably in brave-unbreak.txt—and git commit to save your changes locally
  5. git rev-parse HEAD should show the commit hash, otherwise git log and find it. (You need the full hash.)
  6. git push to push your changes to the remote adblock-lists repository on GitHub. Now your modified brave-unbreak.txt file has a unique URL on raw.githubusercontent.com.
  7. Now, in your local brave/ad-block repository, edit lists/default.h to point to your changed version, similar to this example but specifying the commit hash you found earlier:
diff --git a/lists/default.h b/lists/default.h
index fce7a03..77e2a12 100644
--- a/lists/default.h
+++ b/lists/default.h
@@ -46,7 +46,7 @@ const std::vector<FilterList> default_lists = {
     ""
   }, {
     "2FBEB0BC-E2E1-4170-BAA9-05E76AAB5BA5",
-    "https://raw.githubusercontent.com/brave/adblock-lists/master/brave-unbreak.txt", // NOLINT
+    "https://raw.githubusercontent.com/brave/adblock-lists/YOUR_COMMIT_HASH/brave-unbreak.txt",
     "Brave Unblock",
     {},
     "https://github.com/brave/adblock-lists",
  1. Still in your local brave/ad-block repository, npm run build && npm run data-files to build the changes into the node library and rebuild the data files. This creates files in the out/ subdirectory. The changes you made to brave-unbreak.txt are reflected in the ABPFilterParserData.dat file in this subdirectory.
  2. Close Brave
  3. Copy the local file you built (in brave/ad-block/out/) to your profile extension directory: 
cp out/ABPFilterParserData.dat ~/Library/Application\ Support/BraveSoftware/Brave-Browser/cffkpbalmllkdoenhmdmpbkajipdjfam/1.0.135/4/
  4. Launch Brave and test
Clone this wiki locally