Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/uninstall.js

Issue 29332492: Issue 3269 - Display uninstallation page when uninstalled (Closed)
Patch Set: Addressed feedback Created Dec. 10, 2015, 2:27 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18 /** @module uninstall */
19
20 let {Prefs} = require("prefs");
21 let {Utils} = require("utils");
22
23 const uninstallURL = Utils.getDocLink("uninstall-abp");
Sebastian Noack 2015/12/12 00:31:08 IMO, there is no point in caching this into a glob
kzar 2015/12/12 10:25:40 Done.
24
25 function setUninstallURL()
26 {
27 let info = require("info");
28 let search = [];
29 for (let key of ["addonName", "addonVersion", "application",
30 "applicationVersion", "platform", "platformVersion"])
31 search.push(key + "=" + encodeURIComponent(info[key]));
32
33 search.push("appLocale=" + encodeURIComponent(Utils.appLocale));
Sebastian Noack 2015/12/12 00:31:08 Note that the URL returned by Utils.getDocLink() a
kzar 2015/12/12 10:25:40 OK, updated the issues accordingly and Done.
34
35 let downlCount = Prefs.notificationdata.downloadCount || 0;
36 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount));
37
38 ext.setUninstallURL(uninstallURL + "&" + search.join("&"));
39 }
40
41 function onPrefsLoaded()
42 {
43 Prefs.onLoaded.removeListener(onPrefsLoaded);
44 setUninstallURL();
45 }
46
47 // The uninstall URL contains the notification download count as a parameter,
48 // therefore we must wait for preferences to be loaded before generating the
49 // URL. (But we're not sure if they have already been loaded so we have to do
Sebastian Noack 2015/12/12 00:31:08 Actually we know that prefs haven't been loaded ye
kzar 2015/12/12 10:25:40 Done.
50 // it immediately too!) We also need to re-generate the URL each time the
51 // notification data changes
52 setUninstallURL();
53 Prefs.onLoaded.addListener(onPrefsLoaded);
54 Prefs.onChanged.addListener(function(name)
55 {
56 if (name == "notificationdata")
57 setUninstallURL();
58 });
OLDNEW
« no previous file with comments | « chrome/ext/common.js ('k') | metadata.common » ('j') | safari/ext/common.js » ('J')

Powered by Google App Engine
This is Rietveld