1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00
uBlock/docs/tests/static-filtering-parser-checklist.txt
2022-03-13 08:56:26 -04:00

124 lines
2.5 KiB
Plaintext

! 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 thoroughly 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
!-----------------------
! valid patterns
a*
*$xhr
|*$xhr
|$xhr
||*$xhr
||$xhr
||*|$xhr
! valid hosts file entries
:: ab
:: AB
:: ab # comment
! valid hosts file entries
0.0.0.0 0.0.0.0.example.com
0.0.0.0 localhost.example.com
0.0.0.0 local-host.example.com
0.0.0.0 local.com
0.0.0.0 localhost.com
0.0.0.0 local-host.com
! valid options
$script,redirect=noop.js
*$redirect=noop.js
*$empty
*$xhr,empty
*$xhr,redirect=empty
*$csp=default-src 'none'
*$all,~document
*$all,~popup
*$all,~inline-script
*$all,~inline-font
! valid domain option values
*$domain=toto.com|toto.*|~toto.com|~toto.*|tôtó.ça|tôtó.*|~tôtó.ça|[ff00::0]|1.1.1.1
! valid denyallow option values
*$denyallow=toto.com|tôtó.ça|[ff00::0]|1.1.1.1,domain=toto.com
!--------------------
! Parsing should fail
!--------------------
! bad patterns
a
|
||
$
*
|*
||*
||*|
! bad hosts file entries
:: a
:: ab/
:: ab/ # comment
::/ ab
:: ab$
! ignored hosts file entries
0.0.0.0 0.0.0.0
0.0.0.0 local
0.0.0.0 localhost
! bad regex
/(abc|def/$xhr
! non-redirectable types
*$beacon,redirect-rule=empty
*$ping,redirect-rule=empty
*$websocket,redirect-rule=empty
*$ghide,redirect=noop.js
! can't mix csp with other types or redirect directives
*$csp=default-src 'none',empty
*$csp=default-src 'none',redirect=empty
*$redirect=empty,csp=default-src 'none'
*$csp=default-src 'none',xhr
*$csp=default-src 'none',ghide
*$csp=default-src 'none',csp=script-src 'none'
! https://github.com/gorhill/uBlock/issues/2385#issuecomment-494078763
*$~document
*$~popup
*$~inline-script
*$~inline-font
! invalidity of IP addresses is browser-dependent
! invalid domain= option values
*$domain=.toto.com|toto.com.|[ff00::00000]|1.1.1.1111
! invalid denyallow= option values
*$denyallow=.toto.com|toto.com.|toto.*|~toto.com|~toto.*|[ff00::00000]|1.1.1.1111,domain=toto.com
! denyallow= requires a domain= option
*$script,denyallow=toto.com