Skip to content

Commit db5306c

Browse files
authored
Keep site/global tracker settings from v8 for future use (#1492)
1 parent 46131fb commit db5306c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

extension-manifest-v3/src/store/options.js

+32
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,40 @@ async function migrateFromMV2() {
242242

243243
options.installDate = storage.install_date || '';
244244

245+
// Clear the storage
245246
await chrome.storage.local.clear();
246247

248+
try {
249+
// Keep for the future use global and site specific tracker block/unblock lists
250+
const trackers = storage.bugs.apps;
251+
const optionsFromV8 = {
252+
selectedTrackers: Object.keys(storage.selected_app_ids).map(
253+
(id) => trackers[id].trackerID,
254+
),
255+
siteSpecificBlocks: Object.entries(storage.site_specific_blocks).map(
256+
([domain, ids]) => {
257+
return {
258+
domain,
259+
trackers: ids.map((id) => trackers[id].trackerID),
260+
};
261+
},
262+
),
263+
siteSpecificUnblocks: Object.entries(
264+
storage.site_specific_unblocks,
265+
).map(([domain, ids]) => {
266+
return {
267+
domain,
268+
trackers: ids.map((id) => trackers[id].trackerID),
269+
};
270+
}),
271+
};
272+
273+
// Save options for the future use
274+
await chrome.storage.local.set({ optionsFromV8 });
275+
} catch (e) {
276+
console.error(`Error while migrating site specific tracker lists: `, e);
277+
}
278+
247279
// Delete indexedDBs
248280
// Notice: Doesn't wait to avoid blocking the migrated options
249281
[

0 commit comments

Comments
 (0)