Removing all duplicate cookies before Unifying #323

This commit is contained in:
ManeraKai 2022-06-11 11:31:49 +03:00
parent 0646598478
commit eeb01729ea
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337

View File

@ -287,7 +287,6 @@ async function testLatency(element, instances) {
function copyCookie(frontend, targetUrl, urls, name) {
return new Promise(resolve => {
browser.storage.local.get('firstPartyIsolate', r => {
console.log('r.firstPartyIsolate', r.firstPartyIsolate);
let query;
if (!r.firstPartyIsolate) query = { url: protocolHost(targetUrl), name: name }
else query = { url: protocolHost(targetUrl), name: name, firstPartyDomain: null }
@ -313,10 +312,13 @@ function copyCookie(frontend, targetUrl, urls, name) {
firstPartyDomain: new URL(url).hostname,
};
}
browser.cookies.remove(removeQuery, () => {
browser.cookies.set(setQuery, () => {
browser.storage.local.set({ [`${frontend}_${name}`]: cookie }, () => resolve())
})
function removeCookie() {
return new Promise(resolve => browser.cookies.remove(removeQuery, resolve))
}
browser.cookies.set(setQuery, async () => {
while (await removeCookie() != null) continue;
browser.storage.local.set({ [`${frontend}_${name}`]: cookie }, () => resolve())
});
}
break;