OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 var API = (function() | 18 var API = (function() |
19 { | 19 { |
| 20 const {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |
20 var Filter = require("filterClasses").Filter; | 21 var Filter = require("filterClasses").Filter; |
21 var Subscription = require("subscriptionClasses").Subscription; | 22 var Subscription = require("subscriptionClasses").Subscription; |
22 var SpecialSubscription = require("subscriptionClasses").SpecialSubscription; | 23 var SpecialSubscription = require("subscriptionClasses").SpecialSubscription; |
23 var FilterStorage = require("filterStorage").FilterStorage; | 24 var FilterStorage = require("filterStorage").FilterStorage; |
24 var defaultMatcher = require("matcher").defaultMatcher; | 25 var defaultMatcher = require("matcher").defaultMatcher; |
25 var ElemHide = require("elemHide").ElemHide; | 26 var ElemHide = require("elemHide").ElemHide; |
26 var Synchronizer = require("synchronizer").Synchronizer; | 27 var Synchronizer = require("synchronizer").Synchronizer; |
27 var Prefs = require("prefs").Prefs; | 28 var Prefs = require("prefs").Prefs; |
28 var checkForUpdates = require("updater").checkForUpdates; | 29 var checkForUpdates = require("updater").checkForUpdates; |
29 var Notification = require("notification").Notification; | 30 var Notification = require("notification").Notification; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 checkFilterMatch: function(url, contentTypeMask, documentUrl) | 186 checkFilterMatch: function(url, contentTypeMask, documentUrl) |
186 { | 187 { |
187 var requestHost = extractHostFromURL(url); | 188 var requestHost = extractHostFromURL(url); |
188 var documentHost = extractHostFromURL(documentUrl); | 189 var documentHost = extractHostFromURL(documentUrl); |
189 var thirdParty = isThirdParty(requestHost, documentHost); | 190 var thirdParty = isThirdParty(requestHost, documentHost); |
190 return defaultMatcher.matchesAny(url, contentTypeMask, documentHost, third
Party); | 191 return defaultMatcher.matchesAny(url, contentTypeMask, documentHost, third
Party); |
191 }, | 192 }, |
192 | 193 |
193 getElementHidingSelectors: function(domain) | 194 getElementHidingSelectors: function(domain) |
194 { | 195 { |
195 return ElemHide.getSelectorsForDomain(domain, false); | 196 return ElemHide.getSelectorsForDomain(domain, ElemHide.ALL_MATCHING, false
); |
196 }, | 197 }, |
197 | 198 |
198 getPref: function(pref) | 199 getPref: function(pref) |
199 { | 200 { |
200 return Prefs[pref]; | 201 return Prefs[pref]; |
201 }, | 202 }, |
202 | 203 |
203 setPref: function(pref, value) | 204 setPref: function(pref, value) |
204 { | 205 { |
205 Prefs[pref] = value; | 206 Prefs[pref] = value; |
206 }, | 207 }, |
207 | 208 |
208 forceUpdateCheck: function(eventName) | 209 forceUpdateCheck: function(eventName) |
209 { | 210 { |
210 checkForUpdates(eventName ? _triggerEvent.bind(null, eventName) : null); | 211 checkForUpdates(eventName ? _triggerEvent.bind(null, eventName) : null); |
211 }, | 212 }, |
212 | 213 |
213 getHostFromUrl: function(url) | 214 getHostFromUrl: function(url) |
214 { | 215 { |
215 return extractHostFromURL(url); | 216 return extractHostFromURL(url); |
216 }, | 217 }, |
217 | 218 |
218 compareVersions: function(v1, v2) | 219 compareVersions: function(v1, v2) |
219 { | 220 { |
220 return Services.vc.compare(v1, v2); | 221 return Services.vc.compare(v1, v2); |
221 } | 222 } |
222 }; | 223 }; |
223 })(); | 224 })(); |
OLD | NEW |