prevent duplicate wildcard mappings
This commit is contained in:
parent
f6348fbd3b
commit
bbb18c6ac2
1 changed files with 21 additions and 0 deletions
|
@ -112,6 +112,9 @@ window.assignManager = {
|
||||||
this.setExempted(pageUrlorUrlKey, tabId);
|
this.setExempted(pageUrlorUrlKey, tabId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (data.wildcardHostname) {
|
||||||
|
await this.removeDuplicateWildcardHostname(data.wildcardHostname, siteStoreKey);
|
||||||
|
}
|
||||||
await this.removeWildcardLookup(siteStoreKey);
|
await this.removeWildcardLookup(siteStoreKey);
|
||||||
// eslint-disable-next-line require-atomic-updates
|
// eslint-disable-next-line require-atomic-updates
|
||||||
data.identityMacAddonUUID =
|
data.identityMacAddonUUID =
|
||||||
|
@ -157,6 +160,24 @@ window.assignManager = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Must not set the same wildcardHostname property on multiple sites.
|
||||||
|
// E.g. 'google.com' on both 'www.google.com' and 'mail.google.com'.
|
||||||
|
//
|
||||||
|
// Necessary because the stored wildcardLookup map is 1-to-1, i.e. either
|
||||||
|
// 'google.com' => 'www.google.com', or
|
||||||
|
// 'google.com' => 'mail.google.com', but not both!
|
||||||
|
async removeDuplicateWildcardHostname(wildcardHostname, expectedSiteStoreKey) {
|
||||||
|
const wildcardStoreKey = this.getWildcardStoreKey(wildcardHostname);
|
||||||
|
const siteStoreKey = await this.getByUrlKey(wildcardStoreKey);
|
||||||
|
if (siteStoreKey && siteStoreKey !== expectedSiteStoreKey) {
|
||||||
|
const siteSettings = await this.getByUrlKey(siteStoreKey);
|
||||||
|
if (siteSettings && siteSettings.wildcardHostname === wildcardHostname) {
|
||||||
|
delete siteSettings.wildcardHostname;
|
||||||
|
await this.set(siteStoreKey, siteSettings); // Will cause wildcard mapping to be cleared
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async deleteContainer(userContextId) {
|
async deleteContainer(userContextId) {
|
||||||
const sitesByContainer = await this.getAssignedSites(userContextId);
|
const sitesByContainer = await this.getAssignedSites(userContextId);
|
||||||
this.area.remove(Object.keys(sitesByContainer));
|
this.area.remove(Object.keys(sitesByContainer));
|
||||||
|
|
Loading…
Add table
Reference in a new issue