| Index: lib/antiadblockInit.js |
| =================================================================== |
| --- a/lib/antiadblockInit.js |
| +++ b/lib/antiadblockInit.js |
| @@ -10,16 +10,18 @@ |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| * |
| * You should have received a copy of the GNU General Public License |
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| +/* globals publicSuffixes */ |
| + |
| "use strict"; |
| const {Prefs} = require("prefs"); |
| const {ActiveFilter} = require("filterClasses"); |
| const {FilterStorage} = require("filterStorage"); |
| const {FilterNotifier} = require("filterNotifier"); |
| const {Subscription} = require("subscriptionClasses"); |
| const {Notification} = require("notification"); |
| @@ -45,19 +47,24 @@ |
| { |
| let urlFilters = []; |
| for (let filter of subscription.filters) |
| { |
| if (filter instanceof ActiveFilter && filter.domains) |
| { |
| for (let [domain, included] of filter.domains) |
| { |
| + let domainIsTLD = !domain.includes(".") || domain.endsWith("."); |
|
kzar
2018/05/25 13:51:56
This logic doesn't look right to me, what about th
kzar
2018/05/25 13:51:57
This variable seems kind of pointless, when we onl
Jon Sonesen
2018/05/25 21:04:39
Hm, but there is the case where `com.` and `com` s
|
| + if (domainIsTLD || publicSuffixes.hasOwnProperty(domain)) |
|
kzar
2018/05/25 13:51:57
If the domain ends in "." it won't be found in pub
Jon Sonesen
2018/05/25 21:04:39
Acknowledged.
|
| + continue; |
| let urlFilter = "||" + domain + "^$document"; |
| if (domain && included && urlFilters.indexOf(urlFilter) == -1) |
|
kzar
2018/05/25 13:51:57
It seems a shame we're doing these cheaper checks
Jon Sonesen
2018/05/25 21:04:39
Acknowledged.
|
| + { |
| urlFilters.push(urlFilter); |
| + } |
| } |
| } |
| } |
| notification.urlFilters = urlFilters; |
| Notification.addNotification(notification); |
| Notification.addQuestionListener(notification.id, notificationListener); |
| } |