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;
|
const cookieStoreIDmap = inSync.cookieStoreIDmap;
|
||||||
for (const syncIdentity of inSync.identities) {
|
for (const syncIdentity of inSync.identities) {
|
||||||
syncIdentity.macAddonUUID = cookieStoreIDmap[syncIdentity.cookieStoreId];
|
syncIdentity.macAddonUUID = cookieStoreIDmap[syncIdentity.cookieStoreId];
|
||||||
const compareNames = function (localIdentity) { return (localIdentity.name === syncIdentity.name); };
|
const match = localIdentities.find(localIdentity => localIdentity.name === syncIdentity.name);
|
||||||
const match = localIdentities.find(compareNames);
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
console.log("create new ident: ", syncIdentity.name)
|
console.log("create new ident: ", syncIdentity.name)
|
||||||
newIdentity = await browser.contextualIdentities.create({name: syncIdentity.name, color: syncIdentity.color, icon: syncIdentity.icon});
|
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);
|
return this.storageArea.set(cookieStoreId, containerState);
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateUUID(cookieStoreId, uuid) {
|
async updateUUID(cookieStoreId, uuid) {
|
||||||
const containerState = await this.storageArea.get(cookieStoreId);
|
if (cookieStoreId && uuid) {
|
||||||
containerState.macAddonUUID = uuid;
|
const containerState = await this.storageArea.get(cookieStoreId);
|
||||||
await this.storageArea.set(cookieStoreId, containerState);
|
containerState.macAddonUUID = uuid;
|
||||||
return;
|
await this.storageArea.set(cookieStoreId, containerState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error ("cookieStoreId or uuid missing");
|
||||||
},
|
},
|
||||||
|
|
||||||
async addUUID(cookieStoreId) {
|
async addUUID(cookieStoreId) {
|
||||||
return await this.updateUUID(cookieStoreId, uuidv4());
|
return await this.updateUUID(cookieStoreId, uuidv4());
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue