code review

This commit is contained in:
gorhill 2015-02-25 16:51:04 -05:00
parent a9ce435f1c
commit 24611bab29
1 changed files with 11 additions and 8 deletions

View File

@ -136,6 +136,15 @@
var availableLists = {}; var availableLists = {};
var relocationMap = {}; var relocationMap = {};
var fixLocation = function(location) {
// https://github.com/gorhill/uBlock/issues/418
// We now support built-in external filter lists
if ( /^https?:/.test(location) === false ) {
location = 'assets/thirdparties/' + location;
}
return location;
};
// selected lists // selected lists
var onSelectedListsLoaded = function(store) { var onSelectedListsLoaded = function(store) {
var µb = µBlock; var µb = µBlock;
@ -185,16 +194,10 @@
continue; continue;
} }
entry = locations[location]; entry = locations[location];
// https://github.com/gorhill/uBlock/issues/418 location = fixLocation(location);
// We now support built-in external filter lists
if ( /^https?:/.test(location) === false ) {
location = 'assets/thirdparties/' + location;
}
// Migrate obsolete location to new location, if any // Migrate obsolete location to new location, if any
if ( typeof entry.oldLocation === 'string' ) { if ( typeof entry.oldLocation === 'string' ) {
if ( /^https?:/.test(entry.oldLocation) === false ) { entry.oldLocation = fixLocation(entry.oldLocation);
entry.oldLocation = 'assets/thirdparties/' + entry.oldLocation;
}
relocationMap[entry.oldLocation] = location; relocationMap[entry.oldLocation] = location;
} }
availableLists[location] = entry; availableLists[location] = entry;