A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/gorhill/uBlock/commit/9f7e385a5c15abdf9737366bcf69c00396e6a938 below:

Code review fix re. max string length in bidi-trie · gorhill/uBlock@9f7e385 · GitHub

@@ -333,7 +333,9 @@ const FilterPlain = class {

333 333

}

334 334 335 335

addToTrie(trie) {

336 +

if ( this.s.length > 255 ) { return false; }

336 337

trie.add(this.s, this.tokenBeg);

338 +

return true;

337 339

}

338 340 339 341

static compile(details) {

@@ -351,7 +353,9 @@ const FilterPlain = class {

351 353

}

352 354 353 355

static addToTrie(args, trie) {

356 +

if ( args[1].length > 255 ) { return false; }

354 357

trie.add(args[1], args[2]);

358 +

return true;

355 359

}

356 360

};

357 361

@@ -547,7 +551,9 @@ const FilterPlainHnAnchored = class {

547 551

}

548 552 549 553

addToTrie(trie) {

554 +

if ( this.s.length > 255 ) { return false; }

550 555

trie.add(this.s, this.tokenBeg);

556 +

return true;

551 557

}

552 558 553 559

static compile(details) {

@@ -562,7 +568,9 @@ const FilterPlainHnAnchored = class {

562 568

}

563 569 564 570

static addToTrie(args, trie) {

571 +

if ( args[1].length > 255 ) { return false; }

565 572

trie.add(args[1], args[2]);

573 +

return true;

566 574

}

567 575

};

568 576

@@ -1644,25 +1652,24 @@ const FilterBucket = class {

1644 1652

const fclass = filterClasses[fdata[0]];

1645 1653

if ( fclass.trieableId === 0 ) {

1646 1654

if ( this.plainTrie !== null ) {

1647 -

return fclass.addToTrie(fdata, this.plainTrie);

1648 -

}

1649 -

if ( this.plainCount === 3 ) {

1655 +

if ( fclass.addToTrie(fdata, this.plainTrie) ) { return; }

1656 +

} else if ( this.plainCount < 3 ) {

1657 +

this.plainCount += 1;

1658 +

} else {

1650 1659

this.plainTrie = FilterBucket.trieContainer.createOne();

1651 1660

this._transferTrieable(0, this.plainTrie);

1652 -

return fclass.addToTrie(fdata, this.plainTrie);

1661 +

if ( fclass.addToTrie(fdata, this.plainTrie) ) { return; }

1653 1662

}

1654 -

this.plainCount += 1;

1655 -

}

1656 -

if ( fclass.trieableId === 1 ) {

1663 +

} else if ( fclass.trieableId === 1 ) {

1657 1664

if ( this.plainHnAnchoredTrie !== null ) {

1658 -

return fclass.addToTrie(fdata, this.plainHnAnchoredTrie);

1659 -

}

1660 -

if ( this.plainHnAnchoredCount === 3 ) {

1665 +

if ( fclass.addToTrie(fdata, this.plainHnAnchoredTrie) ) { return; }

1666 +

} else if ( this.plainHnAnchoredCount < 3 ) {

1667 +

this.plainHnAnchoredCount += 1;

1668 +

} else {

1661 1669

this.plainHnAnchoredTrie = FilterBucket.trieContainer.createOne();

1662 1670

this._transferTrieable(1, this.plainHnAnchoredTrie);

1663 -

return fclass.addToTrie(fdata, this.plainHnAnchoredTrie);

1671 +

if ( fclass.addToTrie(fdata, this.plainHnAnchoredTrie) ) { return; }

1664 1672

}

1665 -

this.plainHnAnchoredCount += 1;

1666 1673

}

1667 1674

this.filters.push(filterFromCompiledData(fdata));

1668 1675

}

@@ -1736,8 +1743,8 @@ const FilterBucket = class {

1736 1743

let i = filters.length;

1737 1744

while ( i-- ) {

1738 1745

const f = filters[i];

1739 -

if ( f.trieableId !== trieableId || f.s.length > 255 ) { continue; }

1740 -

f.addToTrie(trie);

1746 +

if ( f.trieableId !== trieableId ) { continue; }

1747 +

if ( f.addToTrie(trie) === false ) { continue; }

1741 1748

filters.splice(i, 1);

1742 1749

}

1743 1750

}

@@ -1764,7 +1771,7 @@ const FilterBucket = class {

1764 1771

}

1765 1772 1766 1773

static optimize() {

1767 -

const trieDetails = this.trieContainer.optimize();

1774 +

const trieDetails = FilterBucket.trieContainer.optimize();

1768 1775

vAPI.localStorage.setItem(

1769 1776

'FilterBucket.trieDetails',

1770 1777

JSON.stringify(trieDetails)


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