A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gorhill/uBlock/commit/4150c17f4a6e1b3bd0c68b91da74c358a92c03ad below:

Add concept of "really bad list" to badlists infrastructure · gorhill/uBlock@4150c17 · GitHub

@@ -481,15 +481,6 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

481 481

let oldAvailableLists = {},

482 482

newAvailableLists = {};

483 483 484 -

if ( this.badLists.size === 0 ) {

485 -

const details = await this.assets.get('ublock-badlists');

486 -

this.badLists = new Set(

487 -

details.content.split(/\s*[\n\r]+\s*/).filter(a => {

488 -

return a !== '' && a.startsWith('#') === false;

489 -

})

490 -

);

491 -

}

492 - 493 484

// User filter list.

494 485

newAvailableLists[this.userFiltersPath] = {

495 486

group: 'user',

@@ -538,12 +529,24 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

538 529

this.saveSelectedFilterLists([ listURL ], true);

539 530

};

540 531 541 -

// Load previously saved available lists -- these contains data

542 -

// computed at run-time, we will reuse this data if possible.

543 -

const [ bin, entries ] = await Promise.all([

532 +

const promises = [

544 533

vAPI.storage.get('availableFilterLists'),

545 534

this.assets.metadata(),

546 -

]);

535 +

this.badLists.size === 0 ? this.assets.get('ublock-badlists') : false,

536 +

];

537 + 538 +

// Load previously saved available lists -- these contains data

539 +

// computed at run-time, we will reuse this data if possible.

540 +

const [ bin, entries, badlists ] = await Promise.all(promises);

541 + 542 +

if ( badlists instanceof Object ) {

543 +

for ( const line of badlists.content.split(/\s*[\n\r]+\s*/) ) {

544 +

if ( line === '' || line.startsWith('#') ) { continue; }

545 +

const fields = line.split(/\s+/);

546 +

const remove = fields.length === 2 && fields[1] === 'nofetch';

547 +

this.badLists.set(fields[0], remove);

548 +

}

549 +

}

547 550 548 551

oldAvailableLists = bin && bin.availableFilterLists || {};

549 552

@@ -725,6 +728,11 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

725 728

}

726 729

}

727 730 731 +

// Skip downloading really bad lists.

732 +

if ( this.badLists.get(assetKey) ) {

733 +

return { assetKey, content: '' };

734 +

}

735 + 728 736

const rawDetails = await this.assets.get(assetKey);

729 737

// Compiling an empty string results in an empty string.

730 738

if ( rawDetails.content === '' ) {

@@ -1331,11 +1339,14 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

1331 1339 1332 1340

µBlock.assetObserver = function(topic, details) {

1333 1341

// Do not update filter list if not in use.

1342 +

// Also, ignore really bad lists, i.e. those which should not even be

1343 +

// fetched from a remote server.

1334 1344

if ( topic === 'before-asset-updated' ) {

1335 1345

if ( details.type === 'filters' ) {

1336 1346

if (

1337 1347

this.availableFilterLists.hasOwnProperty(details.assetKey) === false ||

1338 -

this.selectedFilterLists.indexOf(details.assetKey) === -1

1348 +

this.selectedFilterLists.indexOf(details.assetKey) === -1 ||

1349 +

this.badLists.get(details.assetKey)

1339 1350

) {

1340 1351

return;

1341 1352

}

@@ -1374,7 +1385,7 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {

1374 1385

this.compilePublicSuffixList(details.content);

1375 1386

}

1376 1387

} else if ( details.assetKey === 'ublock-badlists' ) {

1377 -

this.badLists = new Set();

1388 +

this.badLists = new Map();

1378 1389

}

1379 1390

vAPI.messaging.broadcast({

1380 1391

what: 'assetUpdated',


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4