1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 01:59:38 +02:00

Add more checks against unexpected conditions re. assets.json

This commit is contained in:
Raymond Hill 2023-04-21 20:28:49 -04:00
parent 8616b395b2
commit 6294829e68
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1623,13 +1623,17 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
if ( topic === 'assets.json-updated' ) {
const { newDict, oldDict } = details;
if ( newDict['assets.json'] === undefined ) { return; }
if ( oldDict['assets.json'] === undefined ) { return; }
const newDefaultListset = new Set(newDict['assets.json'].defaultListset || []);
const oldDefaultListset = new Set(oldDict['assets.json'].defaultListset || []);
if ( newDefaultListset.size === 0 ) { return; }
if ( oldDefaultListset.size === 0 ) {
Array.from(Object.entries(newDict))
Array.from(Object.entries(oldDict))
.filter(a => a[1].content === 'filters' && a[1].off === undefined)
.map(a => a[0])
.forEach(a => oldDefaultListset.add(a));
if ( oldDefaultListset.size === 0 ) { return; }
}
const selectedListset = new Set(this.selectedFilterLists);
let selectedListModified = false;