1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 01:29:39 +02:00

#760: reflect obsolete status immediately in UI

This commit is contained in:
gorhill 2015-10-14 14:16:43 -04:00
parent 1490307f09
commit 135ad95d61
3 changed files with 24 additions and 8 deletions

View File

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

View File

@ -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;
};
/******************************************************************************/

View File

@ -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: