From 2476f5f83036d810820060d3622df3c216e5dd76 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 5 Jul 2020 13:24:04 -0400 Subject: [PATCH] Add static filter parser checklist To be used to validate the static filtering parser code in uBO. Over time I expect that all theparsing will be done by the static filtering parser, and thus the list here will become useful to detect breaking code changes. --- .../static-filtering-parser-checklist.txt | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 docs/tests/static-filtering-parser-checklist.txt diff --git a/docs/tests/static-filtering-parser-checklist.txt b/docs/tests/static-filtering-parser-checklist.txt new file mode 100644 index 000000000..c85bcd5a2 --- /dev/null +++ b/docs/tests/static-filtering-parser-checklist.txt @@ -0,0 +1,45 @@ +! Title: Static Filtering Parser Checklist +! Homepage: https://github.com/gorhill/uBlock +! Licence: https://github.com/gorhill/uBlock/blob/master/LICENSE.txt +! +! Description: +! To verify that the static filtering parser is properly parsing valid and +! invalid cases, by typically adding the list to uBO, disabling the list, +! and viewing it in uBO's asset viewer. +! +! Feel free to add more entries to more throughly validate the static +! filtering parser, submit the changes in your fork of uBO by opening an +! issue at https://github.com/uBlockOrigin/uBlock-issues/issues + + + + +!----------------------- +! Parsing should succeed +!----------------------- +$script,redirect=noop.js +*$empty +*$xhr,empty +*$redirect=empty +*$xhr,redirect=empty + + + + +!-------------------- +! Parsing should fail +!-------------------- + +! can't redirect without type (except to `empty`) +*$redirect=noop.js + +! can't redirect beacon, ping, websocket +*$beacon,redirect-rule=empty +*$ping,redirect-rule=empty +*$websocket,redirect-rule=empty + +! can't mix csp with other types or redirect directives +*$csp=default-src 'none',empty +*$csp=default-src 'none',redirect=empty +*$csp=default-src 'none',redirect=empty +*$csp=default-src 'none',xhr