Browse Source

code review: fix updating of non-hosts resources

pull/2/head
Raymond Hill 7 years ago
parent
commit
1867635e0d
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 9
      src/js/assets.js
  2. 4
      src/js/storage.js

9
src/js/assets.js

@ -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);

4
src/js/storage.js

@ -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…
Cancel
Save