| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 /** @module uninstall */ | 18 /** @module uninstall */ |
| 19 | 19 |
| 20 let info = require("info"); | |
| 20 let {Prefs} = require("prefs"); | 21 let {Prefs} = require("prefs"); |
| 22 let {Utils} = require("utils"); | |
| 21 | 23 |
| 22 function setUninstallURL() | 24 function setUninstallURL() |
| 23 { | 25 { |
| 24 let info = require("info"); | |
| 25 let search = []; | 26 let search = []; |
| 26 for (let key of ["addonName", "addonVersion", "application", | 27 let keys = ["addonName", "addonVersion", "application", "applicationVersion", |
|
Sebastian Noack
2015/12/12 13:43:27
I just rembered that jshydra generates quite crapp
kzar
2015/12/12 14:13:43
Done.
| |
| 27 "applicationVersion", "platform", "platformVersion"]) | 28 "platform", "platformVersion"]; |
| 29 for (let key of keys) | |
| 28 search.push(key + "=" + encodeURIComponent(info[key])); | 30 search.push(key + "=" + encodeURIComponent(info[key])); |
| 29 | 31 |
| 30 let downlCount = Prefs.notificationdata.downloadCount || 0; | 32 let downlCount = Prefs.notificationdata.downloadCount || 0; |
| 31 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); | 33 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); |
| 32 | 34 |
| 33 chrome.runtime.setUninstallURL( | 35 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + |
| 34 require("utils").Utils.getDocLink("uninstall-abp") + "&" + search.join("&") | 36 search.join("&")); |
|
Sebastian Noack
2015/12/12 13:43:27
As mentioned in the issue, I think we should just
Sebastian Noack
2015/12/12 13:43:27
I'd rather keep imports at the top, even if only u
kzar
2015/12/12 14:13:43
Done.
kzar
2015/12/12 14:13:43
Done. (Provisionally, if they disagree on the issu
| |
| 35 ); | |
| 36 } | 37 } |
| 37 | 38 |
| 38 function onPrefsLoaded() | 39 function onPrefsLoaded() |
| 39 { | 40 { |
| 40 Prefs.onLoaded.removeListener(onPrefsLoaded); | 41 Prefs.onLoaded.removeListener(onPrefsLoaded); |
| 41 setUninstallURL(); | 42 setUninstallURL(); |
| 42 } | 43 } |
| 43 | 44 |
| 44 // The uninstall URL contains the notification download count as a parameter, | 45 // The uninstall URL contains the notification download count as a parameter, |
| 45 // therefore we must wait for preferences to be loaded before generating the | 46 // therefore we must wait for preferences to be loaded before generating the |
| 46 // URL and we need to re-generate it each time the notification data changes. | 47 // URL and we need to re-generate it each time the notification data changes. |
| 47 Prefs.onLoaded.addListener(onPrefsLoaded); | 48 if ("setUninstallURL" in chrome.runtime) |
| 48 Prefs.onChanged.addListener(function(name) | |
| 49 { | 49 { |
| 50 if (name == "notificationdata") | 50 Prefs.onLoaded.addListener(onPrefsLoaded); |
| 51 setUninstallURL(); | 51 Prefs.onChanged.addListener(function(name) |
| 52 }); | 52 { |
| 53 if (name == "notificationdata") | |
| 54 setUninstallURL(); | |
| 55 }); | |
| 56 } | |
| LEFT | RIGHT |