LEFT | RIGHT |
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 16 matching lines...) Expand all Loading... |
27 var defaultMatcher = require("matcher").defaultMatcher; | 27 var defaultMatcher = require("matcher").defaultMatcher; |
28 var CSSRules = require("cssRules").CSSRules; | 28 var CSSRules = require("cssRules").CSSRules; |
29 var NotificationStorage = require("notification").Notification; | 29 var NotificationStorage = require("notification").Notification; |
30 | 30 |
31 var filterClasses = require("filterClasses"); | 31 var filterClasses = require("filterClasses"); |
32 var Filter = filterClasses.Filter; | 32 var Filter = filterClasses.Filter; |
33 var BlockingFilter = filterClasses.BlockingFilter; | 33 var BlockingFilter = filterClasses.BlockingFilter; |
34 var RegExpFilter = filterClasses.RegExpFilter; | 34 var RegExpFilter = filterClasses.RegExpFilter; |
35 var Synchronizer = require("synchronizer").Synchronizer; | 35 var Synchronizer = require("synchronizer").Synchronizer; |
36 | 36 |
| 37 var info = require("info"); |
37 var subscriptionClasses = require("subscriptionClasses"); | 38 var subscriptionClasses = require("subscriptionClasses"); |
38 var Subscription = subscriptionClasses.Subscription; | 39 var Subscription = subscriptionClasses.Subscription; |
39 var DownloadableSubscription = subscriptionClasses.DownloadableSubscription; | 40 var DownloadableSubscription = subscriptionClasses.DownloadableSubscription; |
40 var SpecialSubscription = subscriptionClasses.SpecialSubscription; | 41 var SpecialSubscription = subscriptionClasses.SpecialSubscription; |
41 | 42 |
42 function convertObject(keys, obj) | 43 function convertObject(keys, obj) |
43 { | 44 { |
44 var result = {}; | 45 var result = {}; |
45 for (var i = 0; i < keys.length; i++) | 46 for (var i = 0; i < keys.length; i++) |
46 result[keys[i]] = obj[keys[i]]; | 47 result[keys[i]] = obj[keys[i]]; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 { | 142 { |
142 var subscription = Subscription.fromURL(message.url); | 143 var subscription = Subscription.fromURL(message.url); |
143 subscription.title = message.title; | 144 subscription.title = message.title; |
144 onFilterChange("addSubscription", subscription); | 145 onFilterChange("addSubscription", subscription); |
145 }); | 146 }); |
146 break; | 147 break; |
147 case "app.get": | 148 case "app.get": |
148 if (message.what == "issues") | 149 if (message.what == "issues") |
149 { | 150 { |
150 var subscriptionInit = require("subscriptionInit"); | 151 var subscriptionInit = require("subscriptionInit"); |
151 var info = require("info"); | |
152 callback({ | 152 callback({ |
153 filterlistsReinitialized: subscriptionInit ? subscriptionInit.reinit
ialized : false, | 153 filterlistsReinitialized: subscriptionInit ? subscriptionInit.reinit
ialized : false, |
154 legacySafariVersion: (info.platform == "safari" && ( | 154 legacySafariVersion: (info.platform == "safari" && ( |
155 Services.vc.compare(info.platformVersion, "6.0") < 0 || // bef
oreload breaks websites in Safari 5 | 155 Services.vc.compare(info.platformVersion, "6.0") < 0 || // bef
oreload breaks websites in Safari 5 |
156 Services.vc.compare(info.platformVersion, "6.1") == 0 || // ext
ensions are broken in 6.1 and 7.0 | 156 Services.vc.compare(info.platformVersion, "6.1") == 0 || // ext
ensions are broken in 6.1 and 7.0 |
157 Services.vc.compare(info.platformVersion, "7.0") == 0)) | 157 Services.vc.compare(info.platformVersion, "7.0") == 0)) |
158 }); | 158 }); |
159 } | 159 } |
160 else if (message.what == "doclink") | 160 else if (message.what == "doclink") |
161 callback(Utils.getDocLink(message.link)); | 161 callback(Utils.getDocLink(message.link)); |
162 else if (message.what == "localeInfo") | 162 else if (message.what == "localeInfo") |
163 { | 163 { |
164 var bidiDir; | 164 var bidiDir; |
165 if ("chromeRegistry" in Utils) | 165 if ("chromeRegistry" in Utils) |
166 bidiDir = Utils.chromeRegistry.isLocaleRTL("adblockplus") ? "rtl" :
"ltr"; | 166 bidiDir = Utils.chromeRegistry.isLocaleRTL("adblockplus") ? "rtl" :
"ltr"; |
167 else | 167 else |
168 bidiDir = ext.i18n.getMessage("@@bidi_dir"); | 168 bidiDir = ext.i18n.getMessage("@@bidi_dir"); |
169 | 169 |
170 callback({locale: Utils.appLocale, bidiDir: bidiDir}); | 170 callback({locale: Utils.appLocale, bidiDir: bidiDir}); |
171 } | 171 } |
172 else if (message.what == "addonVersion") | 172 else if (message.what == "addonVersion") |
173 { | 173 { |
174 callback(require("info").addonVersion); | 174 callback(info.addonVersion); |
175 } | 175 } |
176 else if (message.what == "features") | 176 else if (message.what == "features") |
177 { | 177 { |
178 callback({ | 178 callback({ |
| 179 devToolsPanel: info.platform == "chromium", |
179 safariContentBlocker: "safari" in global | 180 safariContentBlocker: "safari" in global |
180 && "extension" in global.safari | 181 && "extension" in global.safari |
181 && "setContentBlocker" in global.safari.extension | 182 && "setContentBlocker" in global.safari.extension |
182 }); | 183 }); |
183 } | 184 } |
184 else | 185 else |
185 callback(null); | 186 callback(null); |
186 break; | 187 break; |
187 case "app.listen": | 188 case "app.listen": |
188 if (message.filter) | 189 if (message.filter) |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if (subscription instanceof DownloadableSubscription) | 388 if (subscription instanceof DownloadableSubscription) |
388 Synchronizer.execute(subscription, true); | 389 Synchronizer.execute(subscription, true); |
389 } | 390 } |
390 break; | 391 break; |
391 case "subscriptions.isDownloading": | 392 case "subscriptions.isDownloading": |
392 callback(Synchronizer.isExecuting(message.url)); | 393 callback(Synchronizer.isExecuting(message.url)); |
393 break; | 394 break; |
394 } | 395 } |
395 }); | 396 }); |
396 })(this); | 397 })(this); |
LEFT | RIGHT |