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

Delta Between Two Patch Sets: lib/firefoxDataCleanup.js

Issue 29526555: Issue 5554 - [webextensions] Adjust data to account for UI limitations (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome
Left Patch Set: Created Aug. 24, 2017, 9:02 a.m.
Right Patch Set: Made imports constant Created Aug. 24, 2017, 10:43 a.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 | lib/prefs.js » ('j') | 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-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
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 "use strict"; 18 "use strict";
19 19
20 let {Filter, ActiveFilter} = require("filterClasses"); 20 const {Filter, ActiveFilter} = require("filterClasses");
21 let {FilterNotifier} = require("filterNotifier"); 21 const {FilterNotifier} = require("filterNotifier");
22 let {FilterStorage} = require("filterStorage"); 22 const {FilterStorage} = require("filterStorage");
23 let {IO} = require("io"); 23 const {IO} = require("io");
24 let {Prefs} = require("prefs"); 24 const {Prefs} = require("prefs");
25 let {SpecialSubscription} = require("subscriptionClasses"); 25 const {SpecialSubscription} = require("subscriptionClasses");
26 26
27 Promise.all([FilterNotifier.once("load"), Prefs.untilLoaded]).then(() => 27 Promise.all([FilterNotifier.once("load"), Prefs.untilLoaded]).then(() =>
28 { 28 {
29 if (Prefs.data_cleanup_done) 29 if (Prefs.data_cleanup_done)
30 return; 30 return;
31
32 if (FilterStorage.firstRun)
33 {
34 Prefs.data_cleanup_done = true;
35 return;
36 }
31 37
32 let haveHitCounts = []; 38 let haveHitCounts = [];
33 39
34 for (let key in Filter.knownFilters) 40 for (let key in Filter.knownFilters)
35 { 41 {
36 let filter = Filter.knownFilters[key]; 42 let filter = Filter.knownFilters[key];
37 if (!(filter instanceof ActiveFilter)) 43 if (!(filter instanceof ActiveFilter))
38 continue; 44 continue;
39 45
40 if (filter.disabled) 46 if (filter.disabled)
(...skipping 22 matching lines...) Expand all
63 if (filter.hitCount || filter.lastHit) 69 if (filter.hitCount || filter.lastHit)
64 haveHitCounts.push(filter); 70 haveHitCounts.push(filter);
65 } 71 }
66 72
67 // Reset hit statistics on any filters having them 73 // Reset hit statistics on any filters having them
68 FilterStorage.resetHitCounts(haveHitCounts); 74 FilterStorage.resetHitCounts(haveHitCounts);
69 75
70 // Remove any existing automatic backups 76 // Remove any existing automatic backups
71 let backups = []; 77 let backups = [];
72 for (let i = 1; i < 100; i++) 78 for (let i = 1; i < 100; i++)
73 backups.push(`file:patterns-backup${i}.ini`); 79 backups.push(`file:patterns-backup${i}.ini`);
Wladimir Palant 2017/08/24 09:08:09 This is using implementation details of io.js whic
74 return browser.storage.local.remove(backups).then(() => 80 browser.storage.local.remove(backups).then(() =>
Sebastian Noack 2017/08/24 09:42:05 Returning this promise here seems weird. Did you m
Wladimir Palant 2017/08/24 09:57:43 Right, this is merely a left-over from a previous
75 { 81 {
76 Prefs.data_cleanup_done = true; 82 Prefs.data_cleanup_done = true;
77 }); 83 });
78 }); 84 });
LEFTRIGHT
« no previous file | lib/prefs.js » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld