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

Side by Side Diff: lib/synchronizer.js

Issue 29332065: Issue 3380 - synchronizer unit tests are broken (Closed)
Patch Set: Created Dec. 7, 2015, 3:45 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-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 /** 18 /**
19 * @fileOverview Manages synchronization of filter subscriptions. 19 * @fileOverview Manages synchronization of filter subscriptions.
20 */ 20 */
21 21
22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 22 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
23 Cu.import("resource://gre/modules/Services.jsm"); 23 Cu.import("resource://gre/modules/Services.jsm");
24 24
25 let {Downloader, Downloadable, 25 var {Downloader, Downloadable,
26 MILLIS_IN_SECOND, MILLIS_IN_MINUTE, MILLIS_IN_HOUR, MILLIS_IN_DAY} = require ("downloader"); 26 MILLIS_IN_SECOND, MILLIS_IN_MINUTE, MILLIS_IN_HOUR, MILLIS_IN_DAY} = require ("downloader");
27 let {Filter, CommentFilter} = require("filterClasses"); 27 var {Filter, CommentFilter} = require("filterClasses");
28 let {FilterStorage} = require("filterStorage"); 28 var {FilterStorage} = require("filterStorage");
29 let {FilterNotifier} = require("filterNotifier"); 29 var {FilterNotifier} = require("filterNotifier");
30 let {Prefs} = require("prefs"); 30 var {Prefs} = require("prefs");
31 let {Subscription, DownloadableSubscription} = require("subscriptionClasses"); 31 var {Subscription, DownloadableSubscription} = require("subscriptionClasses");
32 let {Utils} = require("utils"); 32 var {Utils} = require("utils");
33 33
34 let INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; 34 var INITIAL_DELAY = 1 * MILLIS_IN_MINUTE;
35 let CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; 35 var CHECK_INTERVAL = 1 * MILLIS_IN_HOUR;
36 let DEFAULT_EXPIRATION_INTERVAL = 5 * MILLIS_IN_DAY; 36 var DEFAULT_EXPIRATION_INTERVAL = 5 * MILLIS_IN_DAY;
37 37
38 /** 38 /**
39 * The object providing actual downloading functionality. 39 * The object providing actual downloading functionality.
40 * @type Downloader 40 * @type Downloader
41 */ 41 */
42 let downloader = null; 42 var downloader = null;
43 43
44 /** 44 /**
45 * This object is responsible for downloading filter subscriptions whenever 45 * This object is responsible for downloading filter subscriptions whenever
46 * necessary. 46 * necessary.
47 * @class 47 * @class
48 */ 48 */
49 let Synchronizer = exports.Synchronizer = 49 var Synchronizer = exports.Synchronizer =
50 { 50 {
51 /** 51 /**
52 * Called on module startup. 52 * Called on module startup.
53 */ 53 */
54 init: function() 54 init: function()
55 { 55 {
56 downloader = new Downloader(this._getDownloadables.bind(this), INITIAL_DELAY , CHECK_INTERVAL); 56 downloader = new Downloader(this._getDownloadables.bind(this), INITIAL_DELAY , CHECK_INTERVAL);
57 onShutdown.add(function() 57 onShutdown.add(function()
58 { 58 {
59 downloader.cancel(); 59 downloader.cancel();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j oin("\n"); 311 let data = "[Adblock]\n" + subscription.filters.map((f) => f.text).j oin("\n");
312 redirectCallback("data:text/plain," + encodeURIComponent(data)); 312 redirectCallback("data:text/plain," + encodeURIComponent(data));
313 } 313 }
314 }, false); 314 }, false);
315 request.send(null); 315 request.send(null);
316 } 316 }
317 } 317 }
318 }, 318 },
319 }; 319 };
320 Synchronizer.init(); 320 Synchronizer.init();
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