1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-05-20 12:13:19 +12:00

code review: fix updating of non-hosts resources

This commit is contained in:
Raymond Hill 2018-01-26 11:24:19 -05:00
parent 6207e35a1e
commit 1867635e0d
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
2 changed files with 7 additions and 6 deletions

View file

@ -53,9 +53,10 @@ api.removeObserver = function(observer) {
var fireNotification = function(topic, details) {
var result;
for ( var i = 0; i < observers.length; i++ ) {
if ( observers[i](topic, details) === false ) {
result = false;
for ( let i = 0; i < observers.length; i++ ) {
let r = observers[i](topic, details);
if ( r !== undefined && result === undefined ) {
result = r;
}
}
return result;
@ -821,7 +822,7 @@ var updateNext = function() {
if ( cacheEntry && (cacheEntry.writeTime + assetEntry.updateAfter * 86400000) > now ) {
continue;
}
if ( fireNotification('before-asset-updated', { assetKey: assetKey }) !== false ) {
if ( fireNotification('before-asset-updated', { assetKey: assetKey }) ) {
return assetKey;
}
garbageCollectOne(assetKey);

View file

@ -558,9 +558,9 @@
if ( topic === 'before-asset-updated' ) {
if (
this.liveHostsFiles.hasOwnProperty(details.assetKey) === false ||
this.liveHostsFiles[details.assetKey].off === true
this.liveHostsFiles[details.assetKey].off !== true
) {
return false;
return true;
}
return;
}