added check for uuid in updateUUID
This commit is contained in:
parent
f4024bba66
commit
a7f6659204
2 changed files with 10 additions and 6 deletions
|
@ -712,8 +712,7 @@ async function reconcileIdentitiesByName(inSync){
|
|||
const cookieStoreIDmap = inSync.cookieStoreIDmap;
|
||||
for (const syncIdentity of inSync.identities) {
|
||||
syncIdentity.macAddonUUID = cookieStoreIDmap[syncIdentity.cookieStoreId];
|
||||
const compareNames = function (localIdentity) { return (localIdentity.name === syncIdentity.name); };
|
||||
const match = localIdentities.find(compareNames);
|
||||
const match = localIdentities.find(localIdentity => localIdentity.name === syncIdentity.name);
|
||||
if (!match) {
|
||||
console.log("create new ident: ", syncIdentity.name)
|
||||
newIdentity = await browser.contextualIdentities.create({name: syncIdentity.name, color: syncIdentity.color, icon: syncIdentity.icon});
|
||||
|
|
|
@ -67,12 +67,17 @@ const identityState = {
|
|||
|
||||
return this.storageArea.set(cookieStoreId, containerState);
|
||||
},
|
||||
|
||||
async updateUUID(cookieStoreId, uuid) {
|
||||
const containerState = await this.storageArea.get(cookieStoreId);
|
||||
containerState.macAddonUUID = uuid;
|
||||
await this.storageArea.set(cookieStoreId, containerState);
|
||||
return;
|
||||
if (cookieStoreId && uuid) {
|
||||
const containerState = await this.storageArea.get(cookieStoreId);
|
||||
containerState.macAddonUUID = uuid;
|
||||
await this.storageArea.set(cookieStoreId, containerState);
|
||||
return;
|
||||
}
|
||||
throw new Error ("cookieStoreId or uuid missing");
|
||||
},
|
||||
|
||||
async addUUID(cookieStoreId) {
|
||||
return await this.updateUUID(cookieStoreId, uuidv4());
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue