mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-04 16:47:15 +02:00
Cache extracted compiled filter blocks in reverse lookup code
To avoid repeatedly extracting the blocks on subsequent lookups.
This commit is contained in:
parent
ed0f7ae3ce
commit
574a4e6263
@ -55,7 +55,10 @@ const fromNetFilter = function(details) {
|
|||||||
for ( const assetKey in listEntries ) {
|
for ( const assetKey in listEntries ) {
|
||||||
const entry = listEntries[assetKey];
|
const entry = listEntries[assetKey];
|
||||||
if ( entry === undefined ) { continue; }
|
if ( entry === undefined ) { continue; }
|
||||||
const content = extractBlocks(entry.content, 'NETWORK_FILTERS:GOOD');
|
if ( entry.networkContent === undefined ) {
|
||||||
|
entry.networkContent = extractBlocks(entry.content, 'NETWORK_FILTERS:GOOD');
|
||||||
|
}
|
||||||
|
const content = entry.networkContent;
|
||||||
let pos = 0;
|
let pos = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
pos = content.indexOf(compiledFilter, pos);
|
pos = content.indexOf(compiledFilter, pos);
|
||||||
@ -157,7 +160,8 @@ const fromExtendedFilter = function(details) {
|
|||||||
for ( const assetKey in listEntries ) {
|
for ( const assetKey in listEntries ) {
|
||||||
const entry = listEntries[assetKey];
|
const entry = listEntries[assetKey];
|
||||||
if ( entry === undefined ) { continue; }
|
if ( entry === undefined ) { continue; }
|
||||||
const content = extractBlocks(
|
if ( entry.extendedContent === undefined ) {
|
||||||
|
entry.extendedContent = extractBlocks(
|
||||||
entry.content,
|
entry.content,
|
||||||
'COSMETIC_FILTERS:SPECIFIC',
|
'COSMETIC_FILTERS:SPECIFIC',
|
||||||
'COSMETIC_FILTERS:GENERIC',
|
'COSMETIC_FILTERS:GENERIC',
|
||||||
@ -165,6 +169,8 @@ const fromExtendedFilter = function(details) {
|
|||||||
'HTML_FILTERS',
|
'HTML_FILTERS',
|
||||||
'HTTPHEADER_FILTERS'
|
'HTTPHEADER_FILTERS'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
const content = entry.extendedContent;
|
||||||
let found;
|
let found;
|
||||||
let pos = 0;
|
let pos = 0;
|
||||||
while ( (pos = content.indexOf(needle, pos)) !== -1 ) {
|
while ( (pos = content.indexOf(needle, pos)) !== -1 ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user