mirror of https://github.com/gorhill/uBlock.git
Add static release() to StaticNetFilteringEngine class
The method ensures the actual SNFE is properly reset.
This commit is contained in:
parent
f8f45cab70
commit
e9ae8e1a0f
|
@ -95,7 +95,10 @@ function pslInit(raw) {
|
||||||
return globals.publicSuffixList;
|
return globals.publicSuffixList;
|
||||||
}
|
}
|
||||||
|
|
||||||
raw = readFileSync(resolve(__dirname, './assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat'), 'utf8')
|
raw = readFileSync(
|
||||||
|
resolve(__dirname, './assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat'),
|
||||||
|
'utf8'
|
||||||
|
);
|
||||||
if ( typeof raw !== 'string' || raw.trim() === '' ) {
|
if ( typeof raw !== 'string' || raw.trim() === '' ) {
|
||||||
console.error('Unable to populate public suffix list');
|
console.error('Unable to populate public suffix list');
|
||||||
return;
|
return;
|
||||||
|
@ -147,7 +150,7 @@ async function useLists(lists, options = {}) {
|
||||||
snfe.reset();
|
snfe.reset();
|
||||||
|
|
||||||
if ( Array.isArray(lists) === false || lists.length === 0 ) {
|
if ( Array.isArray(lists) === false || lists.length === 0 ) {
|
||||||
return snfe;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let compiler = null;
|
let compiler = null;
|
||||||
|
@ -176,8 +179,6 @@ async function useLists(lists, options = {}) {
|
||||||
// Commit changes
|
// Commit changes
|
||||||
snfe.freeze();
|
snfe.freeze();
|
||||||
snfe.optimize();
|
snfe.optimize();
|
||||||
|
|
||||||
return snfe;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -253,9 +254,10 @@ class StaticNetFilteringEngine {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
static release() {
|
static async release() {
|
||||||
useLists([]);
|
if ( snfeProxyInstance === null ) { return; }
|
||||||
snfeProxyInstance = null;
|
snfeProxyInstance = null;
|
||||||
|
await useLists([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue