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

Unified Diff: test/filterClasses.js

Issue 29841558: Issue 6815 - Avoid multiple copies of domain maps (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add tests Created July 30, 2018, 5:11 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
« no previous file with comments | « 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
@@ -538,17 +538,16 @@
"f$o$o$csp=f o o");
test.equal(Filter.normalize("/foo$/$ csp = script-src http://example.com/?$1=1&$2=2&$3=3"),
"/foo$/$csp=script-src http://example.com/?$1=1&$2=2&$3=3");
test.equal(Filter.normalize("||content.server.com/files/*.php$rewrite= $1"),
"||content.server.com/files/*.php$rewrite=$1");
test.done();
};
-
exports.testFilterRewriteOption = function(test)
{
let text = "/(content\\.server\\/file\\/.*\\.txt)\\?.*$/$rewrite=$1";
let filter = Filter.fromText(text);
test.equal(filter.rewrite, "$1");
// no rewrite occured: didn't match.
@@ -598,8 +597,24 @@
test.equal(filterStrip.rewrite, "");
test.equal(
filterStrip.rewriteUrl("http://example.com/?tag"),
"http://example.com/?"
);
test.done();
};
+
+exports.testDomainMapDeduplication = function(test)
+{
+ let filter1 = Filter.fromText("example.com##.foo");
+ let filter2 = Filter.fromText("example.com##.bar");
+
+ // This compares the references to make sure that both refer to the same
+ // object (#6815).
+ test.equal(filter1.domains, filter2.domains);
+
+ let filter3 = Filter.fromText("www.example.com##.bar");
+
+ test.notEqual(filter2.domains, filter3.domains);
+
+ test.done();
+};
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld