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:
parent
6207e35a1e
commit
1867635e0d
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue