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;
|
||||
}
|
||||
|
||||
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() === '' ) {
|
||||
console.error('Unable to populate public suffix list');
|
||||
return;
|
||||
|
@ -147,7 +150,7 @@ async function useLists(lists, options = {}) {
|
|||
snfe.reset();
|
||||
|
||||
if ( Array.isArray(lists) === false || lists.length === 0 ) {
|
||||
return snfe;
|
||||
return;
|
||||
}
|
||||
|
||||
let compiler = null;
|
||||
|
@ -176,8 +179,6 @@ async function useLists(lists, options = {}) {
|
|||
// Commit changes
|
||||
snfe.freeze();
|
||||
snfe.optimize();
|
||||
|
||||
return snfe;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -253,9 +254,10 @@ class StaticNetFilteringEngine {
|
|||
return instance;
|
||||
}
|
||||
|
||||
static release() {
|
||||
useLists([]);
|
||||
static async release() {
|
||||
if ( snfeProxyInstance === null ) { return; }
|
||||
snfeProxyInstance = null;
|
||||
await useLists([]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue