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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 "@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest"); | 29 "@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest"); |
30 | 30 |
31 function require(module) | 31 function require(module) |
32 { | 32 { |
33 let result = {}; | 33 let result = {}; |
34 result.wrappedJSObject = result; | 34 result.wrappedJSObject = result; |
35 Services.obs.notifyObservers(result, "adblockplus-require", module); | 35 Services.obs.notifyObservers(result, "adblockplus-require", module); |
36 return result.exports; | 36 return result.exports; |
37 } | 37 } |
38 | 38 |
39 let {Filter} = require("filterClasses"); | 39 let {Filter, RegExpFilter} = require("filterClasses"); |
40 let {FilterNotifier} = require("filterNotifier"); | 40 let {FilterNotifier} = require("filterNotifier"); |
41 let {FilterStorage} = require("filterStorage"); | 41 let {FilterStorage} = require("filterStorage"); |
42 let {defaultMatcher} = require("matcher"); | 42 let {defaultMatcher} = require("matcher"); |
43 let {Prefs} = require("prefs"); | 43 let {Prefs} = require("prefs"); |
44 let {Subscription, SpecialSubscription, RegularSubscription, DownloadableSubscri
ption, ExternalSubscription} = require("subscriptionClasses"); | 44 let {Subscription, SpecialSubscription, RegularSubscription, DownloadableSubscri
ption, ExternalSubscription} = require("subscriptionClasses"); |
45 let {Synchronizer} = require("synchronizer"); | 45 let {Synchronizer} = require("synchronizer"); |
46 let {UI} = require("ui"); | 46 let {UI} = require("ui"); |
47 | 47 |
48 let subscriptionsSavedPref = "subscriptions_saved"; | 48 let subscriptionsSavedPref = "subscriptions_saved"; |
49 | 49 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 let branchName = "extensions." + addonName + "."; | 96 let branchName = "extensions." + addonName + "."; |
97 return Services.prefs.getBranch(branchName); | 97 return Services.prefs.getBranch(branchName); |
98 } | 98 } |
99 | 99 |
100 function getWhitelistingFilter(url) | 100 function getWhitelistingFilter(url) |
101 { | 101 { |
102 let uriObject = Services.io.newURI(url, null, null); | 102 let uriObject = Services.io.newURI(url, null, null); |
103 try | 103 try |
104 { | 104 { |
105 return defaultMatcher.whitelist.matchesAny( | 105 return defaultMatcher.whitelist.matchesAny( |
106 uriObject.spec, "DOCUMENT", uriObject.host, false, null); | 106 uriObject.spec, RegExpFilter.typeMap.DOCUMENT, uriObject.host, false, null
, false); |
107 } | 107 } |
108 catch (e) | 108 catch (e) |
109 { | 109 { |
110 return null; | 110 return null; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 var AdblockPlusApi = | 114 var AdblockPlusApi = |
115 { | 115 { |
116 get filtersLoaded() | 116 get filtersLoaded() |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 { | 296 { |
297 this.whitelistSite(data["url"], data["whitelisted"]); | 297 this.whitelistSite(data["url"], data["whitelisted"]); |
298 return {"success": true}; | 298 return {"success": true}; |
299 } | 299 } |
300 break; | 300 break; |
301 } | 301 } |
302 return {"success": false, "error": "malformed request"}; | 302 return {"success": false, "error": "malformed request"}; |
303 }).bind(this), "AdblockPlus:Api"); | 303 }).bind(this), "AdblockPlus:Api"); |
304 } | 304 } |
305 }; | 305 }; |
OLD | NEW |