mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Throw when useLists() called concurrently
Related feedback: - https://github.com/gorhill/uBlock/pull/3836/files#r690687656
This commit is contained in:
parent
60e254608a
commit
7a5c4e9547
1 changed files with 9 additions and 1 deletions
|
@ -146,6 +146,10 @@ function compileList({ name, raw }, compiler, writer, options = {}) {
|
|||
/******************************************************************************/
|
||||
|
||||
async function useLists(lists, options = {}) {
|
||||
if ( useLists.promise !== null ) {
|
||||
throw new Error('Pending useLists() operation');
|
||||
}
|
||||
|
||||
// Remove all filters
|
||||
snfe.reset();
|
||||
|
||||
|
@ -174,13 +178,17 @@ async function useLists(lists, options = {}) {
|
|||
promises.push(promise.then(list => consumeList(list)));
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
useLists.promise = Promise.all(promises);
|
||||
await useLists.promise;
|
||||
useLists.promise = null;
|
||||
|
||||
// Commit changes
|
||||
snfe.freeze();
|
||||
snfe.optimize();
|
||||
}
|
||||
|
||||
useLists.promise = null;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
class MockStorage {
|
||||
|
|
Loading…
Reference in a new issue