mirror of https://github.com/gorhill/uBlock.git
Add more checks against unexpected conditions re. assets.json
This commit is contained in:
parent
8616b395b2
commit
6294829e68
|
@ -1623,13 +1623,17 @@ self.addEventListener('hiddenSettingsChanged', ( ) => {
|
||||||
|
|
||||||
if ( topic === 'assets.json-updated' ) {
|
if ( topic === 'assets.json-updated' ) {
|
||||||
const { newDict, oldDict } = details;
|
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 newDefaultListset = new Set(newDict['assets.json'].defaultListset || []);
|
||||||
const oldDefaultListset = new Set(oldDict['assets.json'].defaultListset || []);
|
const oldDefaultListset = new Set(oldDict['assets.json'].defaultListset || []);
|
||||||
|
if ( newDefaultListset.size === 0 ) { return; }
|
||||||
if ( oldDefaultListset.size === 0 ) {
|
if ( oldDefaultListset.size === 0 ) {
|
||||||
Array.from(Object.entries(newDict))
|
Array.from(Object.entries(oldDict))
|
||||||
.filter(a => a[1].content === 'filters' && a[1].off === undefined)
|
.filter(a => a[1].content === 'filters' && a[1].off === undefined)
|
||||||
.map(a => a[0])
|
.map(a => a[0])
|
||||||
.forEach(a => oldDefaultListset.add(a));
|
.forEach(a => oldDefaultListset.add(a));
|
||||||
|
if ( oldDefaultListset.size === 0 ) { return; }
|
||||||
}
|
}
|
||||||
const selectedListset = new Set(this.selectedFilterLists);
|
const selectedListset = new Set(this.selectedFilterLists);
|
||||||
let selectedListModified = false;
|
let selectedListModified = false;
|
||||||
|
|
Loading…
Reference in New Issue