Compile JSON rules into a WebKit content filter store to check for syntax errors.
To use, input a file in Apple's JSON content blocker format, either as the first argument or through stdin.
webkit-content-filter-validator
will silently return a zero exit code if the file is well-formatted. Otherwise, it will print WebKit's error to stdout and return a nonzero exit code.
webkit-content-filter-validator
depends on WebKit WPE.
WebKit WPE is packaged as:
libwpewebkit-1.0-dev
under Ubuntuwpewebkit
under Arch Linux
Run make webkit-content-filter-validator
.
Replace wpe-webkit-1.0
with wpe-webkit-1.1
in the Makefile, then proceed as above.
docker build -t webkit-content-filter-validator .
Check the usage:
webkit-content-filter-validator --help
Making input files accessible to the container's filesystem is complicated. The easiest way to pass inputs to the command in the Docker image is through stdin, i.e.:
docker run --rm -i webkit-content-filter-validator < test.json
or,
echo "[{...}]" | docker run --rm -i webkit-content-filter-validator
Run make compile_flags.txt
to setup clangd
IDE integration.