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

Unified Diff: lib/synchronizer.js

Issue 29855555: Issue 6849 - Remove filter list checksum verification (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Remove generateChecksum stub Created Aug. 14, 2018, 9:26 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/stub-modules/utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/synchronizer.js
===================================================================
--- a/lib/synchronizer.js
+++ b/lib/synchronizer.js
@@ -25,17 +25,16 @@
MILLIS_IN_SECOND, MILLIS_IN_MINUTE,
MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("./downloader");
const {Filter} = require("./filterClasses");
const {FilterStorage} = require("./filterStorage");
const {FilterNotifier} = require("./filterNotifier");
const {Prefs} = require("prefs");
const {Subscription,
DownloadableSubscription} = require("./subscriptionClasses");
-const {Utils} = require("utils");
const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE;
const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR;
const DEFAULT_EXPIRATION_INTERVAL = 5 * MILLIS_IN_DAY;
/**
* The object providing actual downloading functionality.
* @type {Downloader}
@@ -149,19 +148,16 @@
redirectCallback)
{
let lines = responseText.split(/[\r\n]+/);
let headerMatch = /\[Adblock(?:\s*Plus\s*([\d.]+)?)?\]/i.exec(lines[0]);
if (!headerMatch)
return errorCallback("synchronize_invalid_data");
let minVersion = headerMatch[1];
- // Don't remove parameter comments immediately but add them to a list first,
- // they need to be considered in the checksum calculation.
- let remove = [];
let params = {
redirect: null,
homepage: null,
title: null,
version: null,
expires: null
};
for (let i = 0; i < lines.length; i++)
@@ -169,24 +165,17 @@
let match = /^\s*!\s*(\w+)\s*:\s*(.*)/.exec(lines[i]);
if (match)
{
let keyword = match[1].toLowerCase();
let value = match[2];
if (keyword in params)
{
params[keyword] = value;
- remove.push(i);
- }
- else if (keyword == "checksum")
- {
lines.splice(i--, 1);
- let checksum = Utils.generateChecksum(lines);
- if (checksum && checksum != value.replace(/=+$/, ""))
- return errorCallback("synchronize_checksum_mismatch");
}
}
}
if (params.redirect)
return redirectCallback(params.redirect);
// Handle redirects
@@ -213,20 +202,16 @@
// The download actually succeeded
subscription.lastSuccess = subscription.lastDownload = Math.round(
Date.now() / MILLIS_IN_SECOND
);
subscription.downloadStatus = "synchronize_ok";
subscription.downloadCount = downloadable.downloadCount;
subscription.errors = 0;
- // Remove lines containing parameters
- for (let i = remove.length - 1; i >= 0; i--)
- lines.splice(remove[i], 1);
-
// Process parameters
if (params.homepage)
{
let url;
try
{
url = new URL(params.homepage);
}
« no previous file with comments | « no previous file | test/stub-modules/utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld