From 36b6e11347672736f3d2e2fda405f8891fee617a Mon Sep 17 00:00:00 2001 From: Alexei Date: Thu, 9 Jan 2020 15:20:13 -0500 Subject: [PATCH] Fix timing issue in Cloudflare migration This bug results in removing pre-trained data for some new users. --- src/js/migrations.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/js/migrations.js b/src/js/migrations.js index 870b9bb4ef..3090e6406d 100644 --- a/src/js/migrations.js +++ b/src/js/migrations.js @@ -293,14 +293,6 @@ exports.Migrations= { }, forgetCloudflare: function (badger) { - console.log("Forgetting Cloudflare domains ..."); - - let actionMap = badger.storage.getBadgerStorageObject("action_map"), - actionClones = actionMap.getItemClones(), - snitchMap = badger.storage.getBadgerStorageObject("snitch_map"), - snitchClones = snitchMap.getItemClones(), - correctedSites = {}; - let config = { name: '__cfduid' }; @@ -309,8 +301,15 @@ exports.Migrations= { } chrome.cookies.getAll(config, function (cookies) { - // assume there is no other tracking for these domains - let cfduidFirstParties = new Set(); + console.log("Forgetting Cloudflare domains ..."); + + let actionMap = badger.storage.getBadgerStorageObject("action_map"), + actionClones = actionMap.getItemClones(), + snitchMap = badger.storage.getBadgerStorageObject("snitch_map"), + snitchClones = snitchMap.getItemClones(), + correctedSites = {}, + // assume the tracking domains seen on these sites are all Cloudflare + cfduidFirstParties = new Set(); cookies.forEach(function (cookie) { // get the base domain (also removes the leading dot)