Fixed infinite loop in updating uuid for identities.
This commit is contained in:
parent
a7d3d6d848
commit
d7c0a3d9e1
1 changed files with 7 additions and 6 deletions
|
@ -12,11 +12,13 @@ const identityState = {
|
||||||
const storageResponse = await this.area.get([storeKey]);
|
const storageResponse = await this.area.get([storeKey]);
|
||||||
if (storageResponse && storeKey in storageResponse) {
|
if (storageResponse && storeKey in storageResponse) {
|
||||||
if (!storageResponse[storeKey].macAddonUUID){
|
if (!storageResponse[storeKey].macAddonUUID){
|
||||||
await identityState.addUUID(cookieStoreId);
|
storageResponse[storeKey].macAddonUUID = uuidv4();
|
||||||
return this.get(cookieStoreId);
|
await this.set(cookieStoreId, storageResponse[cookieStoreId]);
|
||||||
}
|
}
|
||||||
return storageResponse[storeKey];
|
return storageResponse[storeKey];
|
||||||
}
|
}
|
||||||
|
// If local storage doesn't have an entry, look it up to make sure it's
|
||||||
|
// an in-use identity.
|
||||||
const identities = await browser.contextualIdentities.query({});
|
const identities = await browser.contextualIdentities.query({});
|
||||||
const match = identities.find(
|
const match = identities.find(
|
||||||
(identity) => identity.cookieStoreId === cookieStoreId);
|
(identity) => identity.cookieStoreId === cookieStoreId);
|
||||||
|
@ -60,15 +62,14 @@ const identityState = {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!macConfigs[configKey].macAddonUUID) {
|
if (!macConfigs[configKey].macAddonUUID) {
|
||||||
await identityState.addUUID(cookieStoreId);
|
await identityState.storageArea.get(cookieStoreId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const identity of identitiesList) {
|
for (const identity of identitiesList) {
|
||||||
// ensure all identities have an entry in local storage
|
// ensure all identities have an entry in local storage
|
||||||
const data = await this.get(identity.cookieStoreId);
|
await identityState.addUUID(identity.cookieStoreId);
|
||||||
await this.set(identity.cookieStoreId, data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -116,7 +117,7 @@ const identityState = {
|
||||||
},
|
},
|
||||||
|
|
||||||
async addUUID(cookieStoreId) {
|
async addUUID(cookieStoreId) {
|
||||||
return await this.updateUUID(cookieStoreId, uuidv4());
|
await this.storageArea.get(cookieStoreId);
|
||||||
},
|
},
|
||||||
|
|
||||||
async lookupMACaddonUUID(cookieStoreId) {
|
async lookupMACaddonUUID(cookieStoreId) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue