| Left: | ||
| Right: |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 } | 224 } |
| 225 }, | 225 }, |
| 226 initCommunication: function() | 226 initCommunication: function() |
| 227 { | 227 { |
| 228 initFilterListeners(); | 228 initFilterListeners(); |
| 229 | 229 |
| 230 EventDispatcher.instance.registerListener((event, data, callback) => | 230 EventDispatcher.instance.registerListener((event, data, callback) => |
| 231 { | 231 { |
| 232 if (!data) | 232 if (!data) |
| 233 { | 233 { |
| 234 callback.onError("malformed request"); | 234 callback.onError("malformed request"); |
|
anton
2017/10/30 13:16:55
should not `return` be added here?
diegocarloslima
2017/10/30 13:40:11
Acknowledged.
| |
| 235 return; | |
| 235 } | 236 } |
| 236 | 237 |
| 237 if (!this.filtersLoaded) | 238 if (!this.filtersLoaded) |
| 238 { | 239 { |
| 239 callback.onError("filters not loaded"); | 240 callback.onError("filters not loaded"); |
|
anton
2017/10/30 13:16:55
should not `return` be added here?
diegocarloslima
2017/10/30 13:40:11
Acknowledged.
| |
| 241 return; | |
| 240 } | 242 } |
| 241 | 243 |
| 242 switch (data["action"]) | 244 switch (data["action"]) |
| 243 { | 245 { |
| 244 case "getAdblockPlusEnabled": | 246 case "getAdblockPlusEnabled": |
| 245 callback.onSuccess({"value": this.adblockPlusEnabled}); | 247 callback.onSuccess({"value": this.adblockPlusEnabled}); |
| 246 return; | 248 return; |
| 247 case "setAdblockPlusEnabled": | 249 case "setAdblockPlusEnabled": |
| 248 if ("enable" in data) | 250 if ("enable" in data) |
| 249 { | 251 { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 this.whitelistSite(data["url"], data["whitelisted"]); | 314 this.whitelistSite(data["url"], data["whitelisted"]); |
| 313 callback.onSuccess({}); | 315 callback.onSuccess({}); |
| 314 return; | 316 return; |
| 315 } | 317 } |
| 316 break; | 318 break; |
| 317 } | 319 } |
| 318 callback.onError("malformed request"); | 320 callback.onError("malformed request"); |
| 319 }, "AdblockPlus:Api"); | 321 }, "AdblockPlus:Api"); |
| 320 } | 322 } |
| 321 }; | 323 }; |
| LEFT | RIGHT |