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(); |
+}; |