Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/filterClasses.js

Issue 29801609: Issue 6733 - Allow empty values in filter options (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase and simplify Created June 25, 2018, 1:08 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« lib/filterClasses.js ('K') | « lib/filterClasses.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
};
« lib/filterClasses.js ('K') | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld