Skip to content

Commit

Permalink
Fix timing issue in Cloudflare migration
Browse files Browse the repository at this point in the history
This bug results in removing pre-trained data for some new users.
  • Loading branch information
ghostwords committed Jan 9, 2020
1 parent 9e8bef5 commit 36b6e11
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/js/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
};
Expand All @@ -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)
Expand Down

0 comments on commit 36b6e11

Please sign in to comment.