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

Side by Side Diff: lib/uninstall.js

Issue 29336255: Issue 3649 - Truncate notificationDownloadCount (Closed)
Patch Set: Created Feb. 11, 2016, 2:24 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 23
24 function setUninstallURL() 24 function setUninstallURL()
25 { 25 {
26 let search = []; 26 let search = [];
27 let keys = ["addonName", "addonVersion", "application", "applicationVersion", 27 let keys = ["addonName", "addonVersion", "application", "applicationVersion",
28 "platform", "platformVersion"]; 28 "platform", "platformVersion"];
29 for (let key of keys) 29 for (let key of keys)
30 search.push(key + "=" + encodeURIComponent(info[key])); 30 search.push(key + "=" + encodeURIComponent(info[key]));
31 31
32 let downlCount = Prefs.notificationdata.downloadCount || 0; 32 let downlCount = Prefs.notificationdata.downloadCount || 0;
33 if (typeof(downlCount) == "number" && downlCount > 3)
Sebastian Noack 2016/02/11 14:31:24 In the downloader module, it's only truncated abov
Sebastian Noack 2016/02/11 14:31:24 Nit: Mind adding a comment that this code is matte
Sebastian Noack 2016/02/11 14:31:24 Nit: typeof is a keyword not a function, so please
kzar 2016/02/11 14:45:20 Done.
kzar 2016/02/11 14:45:20 Done.
kzar 2016/02/11 14:45:20 Acknowledged.
34 downlCount = "4+";
33 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); 35 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount));
34 36
35 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + 37 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" +
36 search.join("&")); 38 search.join("&"));
37 } 39 }
38 40
39 // The uninstall URL contains the notification download count as a parameter, 41 // The uninstall URL contains the notification download count as a parameter,
40 // therefore we must wait for preferences to be loaded before generating the 42 // therefore we must wait for preferences to be loaded before generating the
41 // URL and we need to re-generate it each time the notification data changes. 43 // URL and we need to re-generate it each time the notification data changes.
42 if ("setUninstallURL" in chrome.runtime) 44 if ("setUninstallURL" in chrome.runtime)
43 { 45 {
44 Prefs.isLoaded.then(setUninstallURL); 46 Prefs.isLoaded.then(setUninstallURL);
45 Prefs.onChanged.addListener(function(name) 47 Prefs.onChanged.addListener(function(name)
46 { 48 {
47 if (name == "notificationdata") 49 if (name == "notificationdata")
48 setUninstallURL(); 50 setUninstallURL();
49 }); 51 });
50 } 52 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld