From b51e951536170b3ee400143c8fa31d3f99e8f097 Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 8 Jun 2015 08:09:08 -0400 Subject: [PATCH] this fixes #313 --- src/js/background.js | 1 - src/js/storage.js | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 2a6027e4e..428451e50 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -39,7 +39,6 @@ var oneHour = 60 * oneMinute; var defaultExternalLists = [ '! Examples:', - '! https://easylist-downloads.adblockplus.org/antiadblockfilters.txt', '! https://easylist-downloads.adblockplus.org/fb_annoyances_full.txt', '! https://easylist-downloads.adblockplus.org/fb_annoyances_sidebar.txt', '! https://easylist-downloads.adblockplus.org/fb_annoyances_newsfeed.txt', diff --git a/src/js/storage.js b/src/js/storage.js index f3ab6a6c1..6c922e1c4 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -443,19 +443,23 @@ var µb = this; var onRawListLoaded = function(details) { - if ( details.content !== '' ) { - var listMeta = µb.remoteBlacklists[path]; - if ( listMeta && listMeta.title === '' ) { - var matches = details.content.slice(0, 1024).match(/(?:^|\n)!\s*Title:([^\n]+)/i); - if ( matches !== null ) { - listMeta.title = matches[1].trim(); - } - } - - //console.debug('µBlock.getCompiledFilterList/onRawListLoaded: compiling "%s"', path); - details.content = µb.compileFilters(details.content); - µb.assets.put(compiledPath, details.content); + if ( details.content === '' ) { + callback(details); + return; } + var listMeta = µb.remoteBlacklists[path]; + // https://github.com/gorhill/uBlock/issues/313 + // Always try to fetch the name if this is an external filter list. + if ( listMeta && listMeta.title === '' || /^https?:/.test(path) ) { + var matches = details.content.slice(0, 1024).match(/(?:^|\n)!\s*Title:([^\n]+)/i); + if ( matches !== null ) { + listMeta.title = matches[1].trim(); + } + } + + //console.debug('µBlock.getCompiledFilterList/onRawListLoaded: compiling "%s"', path); + details.content = µb.compileFilters(details.content); + µb.assets.put(compiledPath, details.content); callback(details); };