fixed initial container sync entry dupe
This commit is contained in:
parent
d7b1e7274f
commit
88d8edce7e
3 changed files with 30 additions and 12 deletions
|
@ -2,7 +2,7 @@
|
|||
"name": "testpilot-containers",
|
||||
"title": "Multi-Account Containers",
|
||||
"description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
|
||||
"version": "6.1.4",
|
||||
"version": "6.1.5",
|
||||
"author": "Andrea Marchesini, Luke Crouch and Jonathan Kingston",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/multi-account-containers/issues"
|
||||
|
|
|
@ -16,10 +16,15 @@ const sync = {
|
|||
const deletedIdentityList =
|
||||
await sync.storageArea.getDeletedIdentityList();
|
||||
if (
|
||||
deletedIdentityList.find(element => element === deletedIdentityUUID)
|
||||
) return;
|
||||
deletedIdentityList.push(deletedIdentityUUID);
|
||||
await sync.storageArea.set({ deletedIdentityList });
|
||||
! deletedIdentityList.find(element => element === deletedIdentityUUID)
|
||||
) {
|
||||
deletedIdentityList.push(deletedIdentityUUID);
|
||||
await sync.storageArea.set({ deletedIdentityList });
|
||||
}
|
||||
await this.removeIdentityKeyFromSync(deletedIdentityUUID);
|
||||
},
|
||||
|
||||
async removeIdentityKeyFromSync(deletedIdentityUUID) {
|
||||
await sync.storageArea.area.remove( "identity@@_" + deletedIdentityUUID);
|
||||
},
|
||||
|
||||
|
@ -337,8 +342,20 @@ async function reconcileIdentities(){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const localIdentities = await browser.contextualIdentities.query({});
|
||||
const syncIdentitiesRemoveDupes =
|
||||
await sync.storageArea.getIdentities();
|
||||
// find any local dupes created on sync storage and delete from sync storage
|
||||
for (const localIdentity of localIdentities) {
|
||||
const syncIdentitiesOfName = syncIdentitiesRemoveDupes
|
||||
.filter(identity => identity.name === localIdentity.name);
|
||||
if (syncIdentitiesOfName.length > 1) {
|
||||
const identityMatchingContextId = syncIdentitiesOfName
|
||||
.find(identity => identity.cookieStoreId === localIdentity.cookieStoreId);
|
||||
if (identityMatchingContextId)
|
||||
await sync.storageArea.removeIdentityKeyFromSync(identityMatchingContextId.macAddonUUID);
|
||||
}
|
||||
}
|
||||
const syncIdentities =
|
||||
await sync.storageArea.getIdentities();
|
||||
// now compare all containers for matching names.
|
||||
|
@ -397,11 +414,12 @@ async function updateIdentityWithSyncInfo(syncIdentity, localMatch) {
|
|||
}
|
||||
}
|
||||
// Sync is truth. If all is the same, update the local uuid to match sync
|
||||
await identityState.updateUUID(
|
||||
localMatch.cookieStoreId,
|
||||
syncIdentity.macAddonUUID
|
||||
);
|
||||
|
||||
if (localMatch.macAddonUUID !== syncIdentity.macAddonUUID) {
|
||||
await identityState.updateUUID(
|
||||
localMatch.cookieStoreId,
|
||||
syncIdentity.macAddonUUID
|
||||
);
|
||||
}
|
||||
// TODOkmw: update any site assignment UUIDs
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Firefox Multi-Account Containers",
|
||||
"version": "6.1.4",
|
||||
"version": "6.1.5",
|
||||
"incognito": "not_allowed",
|
||||
"description": "Multi-Account Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
|
||||
"icons": {
|
||||
|
|
Loading…
Add table
Reference in a new issue