| Index: test/filterClasses.js |
| =================================================================== |
| --- a/test/filterClasses.js |
| +++ b/test/filterClasses.js |
| @@ -478,16 +478,18 @@ |
| "domains=domain.com|foo.com", |
| "sitekeys=FOO", |
| "regexp=b\\$la", |
| "contentType=" + t.CSP |
| ] |
| ); |
| // Some $csp edge cases |
| + test.equal(Filter.normalize("$csp= "), |
|
Manish Jethani
2018/06/25 13:13:44
This is important now because we want to return In
|
| + "$csp="); |
| test.equal(Filter.normalize("$csp= c s p"), |
| "$csp=c s p"); |
| test.equal(Filter.normalize("$$csp= c s p"), |
| "$$csp=c s p"); |
| test.equal(Filter.normalize("$$$csp= c s p"), |
| "$$$csp=c s p"); |
| test.equal(Filter.normalize("foo?csp=b a r$csp=script-src 'self'"), |
| "foo?csp=bar$csp=script-src 'self'"); |
| @@ -551,10 +553,20 @@ |
| let rewriteEvil = "/(^https?:\\/\\/[^/])/$script,rewrite=$1.evil.com"; |
| let filterEvil = Filter.fromText(rewriteEvil); |
| test.equal( |
| filterEvil.rewriteUrl("https://www.adblockplus.org/script.js"), |
| "https://www.adblockplus.org/script.js" |
| ); |
| + // Strip. |
| + let rewriteStrip = "tag$rewrite="; |
| + let filterStrip = Filter.fromText(rewriteStrip); |
| + |
| + test.equal(filterStrip.rewrite, ""); |
| + test.equal( |
| + filterStrip.rewriteUrl("http://example.com/?tag"), |
| + "http://example.com/?" |
| + ); |
| + |
| test.done(); |
| }; |