| Index: lib/synchronizer.js |
| =================================================================== |
| --- a/lib/synchronizer.js |
| +++ b/lib/synchronizer.js |
| @@ -20,17 +20,17 @@ |
| /** |
| * @fileOverview Manages synchronization of filter subscriptions. |
| */ |
| const {Downloader, Downloadable, |
| MILLIS_IN_SECOND, MILLIS_IN_MINUTE, |
| MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("./downloader"); |
| const {Filter} = require("./filterClasses"); |
| -const {FilterStorage} = require("./filterStorage"); |
| +const {filterStorage} = require("./filterStorage"); |
| const {filterNotifier} = require("./filterNotifier"); |
| const {Prefs} = require("prefs"); |
| const {Subscription, |
| DownloadableSubscription} = require("./subscriptionClasses"); |
| const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; |
| const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; |
| const DEFAULT_EXPIRATION_INTERVAL = 5 * MILLIS_IN_DAY; |
| @@ -90,17 +90,17 @@ |
| * downloaded. |
| * @yields {Downloadable} |
| */ |
| *_getDownloadables() |
| { |
| if (!Prefs.subscriptions_autoupdate) |
| return; |
| - for (let subscription of FilterStorage.subscriptions()) |
| + for (let subscription of filterStorage.subscriptions()) |
| { |
| if (subscription instanceof DownloadableSubscription) |
| yield this._getDownloadable(subscription, false); |
| } |
| } |
| /** |
| * Creates a {@link Downloadable} instance for a subscription. |
| @@ -181,24 +181,24 @@ |
| if (downloadable.redirectURL && |
| downloadable.redirectURL != downloadable.url) |
| { |
| let oldSubscription = Subscription.fromURL(downloadable.url); |
| subscription.title = oldSubscription.title; |
| subscription.disabled = oldSubscription.disabled; |
| subscription.lastCheck = oldSubscription.lastCheck; |
| - let listed = FilterStorage.knownSubscriptions.has(oldSubscription.url); |
| + let listed = filterStorage.knownSubscriptions.has(oldSubscription.url); |
| if (listed) |
| - FilterStorage.removeSubscription(oldSubscription); |
| + filterStorage.removeSubscription(oldSubscription); |
| Subscription.knownSubscriptions.delete(oldSubscription.url); |
| if (listed) |
| - FilterStorage.addSubscription(subscription); |
| + filterStorage.addSubscription(subscription); |
| } |
| // The download actually succeeded |
| subscription.lastSuccess = subscription.lastDownload = Math.round( |
| Date.now() / MILLIS_IN_SECOND |
| ); |
| subscription.downloadStatus = "synchronize_ok"; |
| subscription.downloadCount = downloadable.downloadCount; |
| @@ -262,17 +262,17 @@ |
| let filters = []; |
| for (let line of lines) |
| { |
| line = Filter.normalize(line); |
| if (line) |
| filters.push(Filter.fromText(line)); |
| } |
| - FilterStorage.updateSubscriptionFilters(subscription, filters); |
| + filterStorage.updateSubscriptionFilters(subscription, filters); |
| } |
| _onDownloadError(downloadable, downloadURL, error, channelStatus, |
| responseStatus, redirectCallback) |
| { |
| let subscription = Subscription.fromURL(downloadable.url); |
| subscription.lastDownload = Math.round(Date.now() / MILLIS_IN_SECOND); |
| subscription.downloadStatus = error; |
| @@ -310,17 +310,17 @@ |
| request.channel.loadFlags = request.channel.loadFlags | |
| request.channel.INHIBIT_CACHING | |
| request.channel.VALIDATE_ALWAYS; |
| request.addEventListener("load", ev => |
| { |
| if (onShutdown.done) |
| return; |
| - if (!FilterStorage.knownSubscriptions.has(subscription.url)) |
| + if (!filterStorage.knownSubscriptions.has(subscription.url)) |
| return; |
| let match = /^(\d+)(?:\s+(\S+))?$/.exec(request.responseText); |
| if (match && match[1] == "301" && // Moved permanently |
| match[2] && /^https?:\/\//i.test(match[2])) |
| { |
| redirectCallback(match[2]); |
| } |