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

Delta Between Two Patch Sets: lib/uninstall.js

Issue 29336255: Issue 3649 - Truncate notificationDownloadCount (Closed)
Left Patch Set: Created Feb. 11, 2016, 2:24 p.m.
Right Patch Set: Addressed Sebastian's feedback Created Feb. 11, 2016, 2:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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) 33
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 // FIXME - Once the changes for issue #3650 land and are included we should
35 // remove this check. (The number will be already truncated for us.)
36 if (downlCount > 4)
34 downlCount = "4+"; 37 downlCount = "4+";
38
35 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); 39 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount));
36 40
37 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + 41 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" +
38 search.join("&")); 42 search.join("&"));
39 } 43 }
40 44
41 // The uninstall URL contains the notification download count as a parameter, 45 // The uninstall URL contains the notification download count as a parameter,
42 // 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
43 // 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.
44 if ("setUninstallURL" in chrome.runtime) 48 if ("setUninstallURL" in chrome.runtime)
45 { 49 {
46 Prefs.isLoaded.then(setUninstallURL); 50 Prefs.isLoaded.then(setUninstallURL);
47 Prefs.onChanged.addListener(function(name) 51 Prefs.onChanged.addListener(function(name)
48 { 52 {
49 if (name == "notificationdata") 53 if (name == "notificationdata")
50 setUninstallURL(); 54 setUninstallURL();
51 }); 55 });
52 } 56 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld