| LEFT | RIGHT | 
|---|
|  | 1 /* | 
|  | 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
|  | 3  * Copyright (C) 2006-2016 Eyeo GmbH | 
|  | 4  * | 
|  | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
|  | 6  * it under the terms of the GNU General Public License version 3 as | 
|  | 7  * published by the Free Software Foundation. | 
|  | 8  * | 
|  | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
|  | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12  * GNU General Public License for more details. | 
|  | 13  * | 
|  | 14  * You should have received a copy of the GNU General Public License | 
|  | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 16  */ | 
|  | 17 | 
| 1 "use strict"; | 18 "use strict"; | 
| 2 | 19 | 
| 3 let {Filter, RegExpFilter} = require("../lib/filterClasses"); | 20 let {createSandbox} = require("./_common"); | 
|  | 21 | 
|  | 22 let Filter = null; | 
|  | 23 let RegExpFilter = null; | 
|  | 24 | 
|  | 25 exports.setUp = function(callback) | 
|  | 26 { | 
|  | 27   let sandboxedRequire = createSandbox(); | 
|  | 28   ({Filter, RegExpFilter} = sandboxedRequire("../lib/filterClassesNew")); | 
|  | 29   callback(); | 
|  | 30 }; | 
| 4 | 31 | 
| 5 function testMatch(test, text, location, contentType, docDomain, thirdParty, sit
     ekey, expected) | 32 function testMatch(test, text, location, contentType, docDomain, thirdParty, sit
     ekey, expected) | 
| 6 { | 33 { | 
| 7   function testMatch_internal(text, location, contentType, docDomain, thirdParty
     , sitekey, expected) | 34   function testMatch_internal(text, location, contentType, docDomain, thirdParty
     , sitekey, expected) | 
| 8   { | 35   { | 
| 9     let filter = Filter.fromText(text); | 36     let filter = Filter.fromText(text); | 
| 10     let result = filter.matches(location, RegExpFilter.typeMap[contentType], doc
     Domain, thirdParty, sitekey); | 37     let result = filter.matches(location, RegExpFilter.typeMap[contentType], doc
     Domain, thirdParty, sitekey); | 
| 11     test.equal(result, expected, '"' + text + '".matches(' + location + ", " + c
     ontentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-part
     y") + ", " + (sitekey || "no-sitekey") + ")"); | 38     test.equal(result, expected, '"' + text + '".matches(' + location + ", " + c
     ontentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-part
     y") + ", " + (sitekey || "no-sitekey") + ")"); | 
| 12     filter.delete() | 39     filter.delete() | 
| 13   } | 40   } | 
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 323   testMatch(test, "@@test$document,~image", "http://test/", "DOCUMENT", null, fa
     lse, null, true); | 350   testMatch(test, "@@test$document,~image", "http://test/", "DOCUMENT", null, fa
     lse, null, true); | 
| 324   testMatch(test, "@@test$document,domain=foo.com", "http://test/", "DOCUMENT", 
     "foo.com", false, null, true); | 351   testMatch(test, "@@test$document,domain=foo.com", "http://test/", "DOCUMENT", 
     "foo.com", false, null, true); | 
| 325   testMatch(test, "@@test$document,domain=foo.com", "http://test/", "DOCUMENT", 
     "bar.com", false, null, false); | 352   testMatch(test, "@@test$document,domain=foo.com", "http://test/", "DOCUMENT", 
     "bar.com", false, null, false); | 
| 326   testMatch(test, "@@test$document,domain=~foo.com", "http://test/", "DOCUMENT",
      "foo.com", false, null, false); | 353   testMatch(test, "@@test$document,domain=~foo.com", "http://test/", "DOCUMENT",
      "foo.com", false, null, false); | 
| 327   testMatch(test, "@@test$document,domain=~foo.com", "http://test/", "DOCUMENT",
      "bar.com", false, null, true); | 354   testMatch(test, "@@test$document,domain=~foo.com", "http://test/", "DOCUMENT",
      "bar.com", false, null, true); | 
| 328   testMatch(test, "@@test$document,sitekey=foo-publickey", "http://test/", "DOCU
     MENT", "foo.com", false, "foo-publickey", true); | 355   testMatch(test, "@@test$document,sitekey=foo-publickey", "http://test/", "DOCU
     MENT", "foo.com", false, "foo-publickey", true); | 
| 329   testMatch(test, "@@test$document,sitekey=foo-publickey", "http://test/", "DOCU
     MENT", "foo.com", false, null, false); | 356   testMatch(test, "@@test$document,sitekey=foo-publickey", "http://test/", "DOCU
     MENT", "foo.com", false, null, false); | 
| 330 | 357 | 
| 331   test.done(); | 358   test.done(); | 
| 332 }; | 359 }; | 
| LEFT | RIGHT | 
|---|