maximtop / SampleAdBlocker

Sample AdBlocker for Safari

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SampleAdBlocker

Development

Be sure you have installed make utility

Setup

To setup project run: make setup

Build

To build run: make build

Lint

To lint run: make lint

What I have learned building simple content blocker with dynamic rules list and web extension for macOS

  • To log url with NSLog better use .path method instead of .absoluteString or .absoluteURL, otherwise log won't print the whole path if it meet the space in the pathname

  • In order to launch debugger for content blocker do not forget to check the Debugging Tool checkbox image

  • Do not forget to add correct app group,otherwise content blocker won't be able to load rules (/Users/<username>/Library/Group Containers/group.SampleAdBlocker/customBlockerList.json) image

  • To debug content blocker you can attach to the process name or pid image with the name of the content blocker image

  • Log messages from content blocker you can see in the Console.app if you call NSLog("debug message") in the content blocker code image

  • Check that you have allowed unsigned extensions, if your extension is not signed image

About

Sample AdBlocker for Safari


Languages

Language:JavaScript 98.8%Language:Swift 0.6%Language:TypeScript 0.5%Language:HTML 0.0%Language:Makefile 0.0%Language:CSS 0.0%