added some checks on sync and some error handling for bad site assignment info

This commit is contained in:
Kendall Werts
2020-01-09 16:36:26 -06:00
parent 9de6df6157
commit 5ae7a395a1
4 changed files with 285 additions and 163 deletions
+25
View File
@@ -107,6 +107,31 @@ const assignManager = {
}
return sites;
},
/*
* Looks for abandoned site assignments. If there is no identity with
* the site assignment's userContextId (cookieStoreId), then the assignment
* is removed.
*/
async cleanup() {
const identitiesList = await browser.contextualIdentities.query({});
const macConfigs = await this.area.get();
for(const configKey of Object.keys(macConfigs)) {
if (configKey.includes("siteContainerMap@@_")) {
const cookieStoreId =
"firefox-container-" + macConfigs[configKey].userContextId;
const match = identitiesList.find(
localIdentity => localIdentity.cookieStoreId === cookieStoreId
);
if (!match) {
await this.remove(configKey.replace(/^siteContainerMap@@_/, "https://"));
continue;
}
}
}
}
},
_neverAsk(m) {