Skip to content

Commit a2da894

Browse files
authored
Update adblockpluscore to ebfc7b0 (#2046)
1 parent 488872e commit a2da894

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

packages/adblocker-benchmarks/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ all: deps run
44
requests.json:
55
curl https://cdn.cliqz.com/adblocking/requests_top500.json.gz | gunzip > requests.json
66

7-
# VERSION: a15e8020d092f7b9f96834d237b6ca560c6b4335
7+
# VERSION: ebfc7b0300879ad44dba6a051c3c34b508b5a4f7
88
./blockers/adblockpluscore:
9-
git clone --branch=next https://github.com/adblockplus/adblockpluscore.git ./blockers/adblockpluscore
10-
cd ./blockers/adblockpluscore && git reset --hard a15e8020d092f7b9f96834d237b6ca560c6b4335
9+
git clone https://github.com/adblockplus/adblockpluscore.git ./blockers/adblockpluscore
10+
cd ./blockers/adblockpluscore && git reset --hard ebfc7b0300879ad44dba6a051c3c34b508b5a4f7
1111

1212
adblockpluscore: ./blockers/adblockpluscore
1313

packages/adblocker-benchmarks/blockers/adblockplus.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
77
*/
88

9+
const { contentTypes } = require('./adblockpluscore/lib/contentTypes.js');
910
const { CombinedMatcher } = require('./adblockpluscore/lib/matcher.js');
10-
const { Filter, RegExpFilter } = require('./adblockpluscore/lib/filterClasses.js');
11+
const { Filter } = require('./adblockpluscore/lib/filterClasses.js');
1112
const { parseURL } = require('./adblockpluscore/lib/url.js');
1213

1314
// Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests.
14-
RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
15+
contentTypes.OBJECT_SUBREQUEST = contentTypes.OBJECT;
1516

1617
// Map of content types reported by the browser to the respecitve content types
1718
// used by Adblock Plus. Other content types are simply mapped to OTHER.
1819
const resourceTypes = new Map(
1920
(function* resourceTypesGenerator() {
20-
for (const type in RegExpFilter.typeMap) yield [type.toLowerCase(), type];
21+
for (const type in contentTypes) yield [type.toLowerCase(), type];
2122

2223
yield ['sub_frame', 'SUBDOCUMENT'];
2324

@@ -41,7 +42,7 @@ module.exports = class AdBlockPlus {
4142
const line = lines[i].trim();
4243
if (line.length !== 0 && line[0] !== '!') {
4344
const filter = Filter.fromText(line);
44-
if (filter.type === 'blocking' || filter.type === 'whitelist') {
45+
if (filter.type === 'blocking' || filter.type === 'allowing') {
4546
filters.push(filter);
4647
matcher.add(filter);
4748
}
@@ -79,9 +80,9 @@ module.exports = class AdBlockPlus {
7980
match(request) {
8081
const url = parseURL(request.url);
8182
const sourceURL = parseURL(request.frameUrl);
82-
const filter = this.matcher.matchesAny(
83+
const filter = this.matcher.match(
8384
url,
84-
RegExpFilter.typeMap[resourceTypes.get(request.type) || 'OTHER'],
85+
contentTypes[resourceTypes.get(request.type) || 'OTHER'],
8586
sourceURL.hostname,
8687
null,
8788
false,

0 commit comments

Comments
 (0)