diff options
author | gorhill <rhill@raymondhill.net> | 2015-10-14 14:16:43 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-10-14 14:16:43 -0400 |
commit | 135ad95d61871db9054a52e478170d5f91221787 (patch) | |
tree | cc2d8ae6ab56defcd4e205984e886f7f36dc1d96 /src | |
parent | 1490307f093f294e893acd36a7ecf0a96f992c8a (diff) | |
download | uBlock-135ad95d61871db9054a52e478170d5f91221787.zip uBlock-135ad95d61871db9054a52e478170d5f91221787.tar.gz uBlock-135ad95d61871db9054a52e478170d5f91221787.tar.bz2 |
#760: reflect obsolete status immediately in UI
Diffstat (limited to 'src')
-rw-r--r-- | src/js/3p-filters.js | 14 | ||||
-rw-r--r-- | src/js/assets.js | 16 | ||||
-rw-r--r-- | src/js/messaging.js | 2 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/js/3p-filters.js b/src/js/3p-filters.js index a3e81b8..b5fca1b 100644 --- a/src/js/3p-filters.js +++ b/src/js/3p-filters.js @@ -371,8 +371,22 @@ var onPurgeClicked = function() { if ( !href ) { return; } + messager.send({ what: 'purgeCache', path: href }); button.remove(); + + // If the cached version is purged, the installed version must be assumed + // to be obsolete. + var entry = listDetails.current && listDetails.current[href]; + if ( entry && entry.off !== true ) { + if ( typeof entry.homeURL !== 'string' || entry.homeURL === '' ) { + li.descendants('span.status.new').css('display', ''); + } else { + li.descendants('span.status.obsolete').css('display', ''); + } + needUpdate = true; + } + if ( li.descendants('input').first().prop('checked') ) { cacheWasPurged = true; renderWidgets(); diff --git a/src/js/assets.js b/src/js/assets.js index 21878f8..08616c5 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -412,10 +412,12 @@ var getRepoMetadata = function(callback) { // If the resource does not have a cached instance, we must reset // the checksum to its value at install time. if ( - cachedAssetsManager.exists(path) === false && - stringIsNotEmpty(defaultChecksums[path]) + stringIsNotEmpty(defaultChecksums[path]) && + entry.localChecksum !== defaultChecksums[path] && + cachedAssetsManager.exists(path) === false ) { entry.localChecksum = defaultChecksums[path]; + checksumsChanged = true; } // If repo checksums could not be fetched, assume no change. // https://github.com/gorhill/uBlock/issues/602 @@ -1211,17 +1213,17 @@ exports.metadata = function(callback) { /******************************************************************************/ exports.purge = function(pattern, before) { - // Purging means we should mark resources current metadata as obsolete. - lastRepoMetaTimestamp = 0; - cachedAssetsManager.remove(pattern, before); }; -exports.purgeAll = function(callback) { - // Purging means we should mark resources current metadata as obsolete. +exports.purgeCacheableAsset = function(pattern, before) { + cachedAssetsManager.remove(pattern, before); lastRepoMetaTimestamp = 0; +}; +exports.purgeAll = function(callback) { cachedAssetsManager.removeAll(callback); + lastRepoMetaTimestamp = 0; }; /******************************************************************************/ diff --git a/src/js/messaging.js b/src/js/messaging.js index 2841fef..6076f8d 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -815,7 +815,7 @@ var onMessage = function(request, sender, callback) { switch ( request.what ) { case 'purgeCache': - µb.assets.purge(request.path); + µb.assets.purgeCacheableAsset(request.path); break; default: |