mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-16 09:15:03 +12:00
Fix exception thrown when a stock asset is removed
Related feedback: - https://www.reddit.com/r/uMatrix/comments/ftebgz/
This commit is contained in:
parent
be3990e24e
commit
c2b4adb7f1
|
@ -16,25 +16,6 @@
|
|||
"assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat"
|
||||
]
|
||||
},
|
||||
"malware-0": {
|
||||
"content": "filters",
|
||||
"title": "Malware Domain List",
|
||||
"contentURL": [
|
||||
"https://www.malwaredomainlist.com/hostslist/hosts.txt",
|
||||
"assets/thirdparties/www.malwaredomainlist.com/hostslist/hosts.txt"
|
||||
]
|
||||
},
|
||||
"malware-1": {
|
||||
"content": "filters",
|
||||
"title": "Malware domains",
|
||||
"contentURL": [
|
||||
"https://mirror.cedia.org.ec/malwaredomains/justdomains",
|
||||
"https://mirror1.malwaredomains.com/files/justdomains",
|
||||
"assets/thirdparties/mirror1.malwaredomains.com/files/justdomains",
|
||||
"assets/thirdparties/mirror1.malwaredomains.com/files/justdomains.txt"
|
||||
],
|
||||
"supportURL": "http://www.malwaredomains.com/"
|
||||
},
|
||||
"dpollock-0": {
|
||||
"content": "filters",
|
||||
"updateAfter": 11,
|
||||
|
|
|
@ -552,12 +552,22 @@
|
|||
var usedCount = this.ubiquitousBlacklist.count;
|
||||
var duplicateCount = this.ubiquitousBlacklist.duplicateCount;
|
||||
|
||||
// https://www.reddit.com/r/uMatrix/comments/ftebgz/
|
||||
// Be ready to deal with a removed asset.
|
||||
|
||||
if ( typeof details.content === 'string' && details.content !== '' ) {
|
||||
this.mergeHostsFileContent(details.content);
|
||||
}
|
||||
|
||||
usedCount = this.ubiquitousBlacklist.count - usedCount;
|
||||
duplicateCount = this.ubiquitousBlacklist.duplicateCount - duplicateCount;
|
||||
|
||||
let hostsFileMeta = this.liveHostsFiles.get(details.assetKey);
|
||||
const hostsFileMeta = this.liveHostsFiles.get(details.assetKey);
|
||||
if ( hostsFileMeta === undefined ) {
|
||||
this.liveHostsFiles.delete(details.assetKey);
|
||||
return;
|
||||
}
|
||||
|
||||
hostsFileMeta.entryCount = usedCount + duplicateCount;
|
||||
hostsFileMeta.entryUsedCount = usedCount;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue