Don't use hard coded browser name prefix 1

This commit is contained in:
Aaron-P 2019-04-14 19:35:28 -06:00 committed by GitHub
parent 6f4d3c4327
commit a804b75f09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
const DEFAULT_TAB = "about:newtab"; const DEFAULT_TAB = "about:newtab";
const BROWSER_NAME = (await browser.runtime.getBrowserInfo()).name.toLowerCase();
const backgroundLogic = { const backgroundLogic = {
NEW_TAB_PAGES: new Set([ NEW_TAB_PAGES: new Set([
"about:startpage", "about:startpage",
@ -19,7 +20,7 @@ const backgroundLogic = {
if (!cookieStoreId) { if (!cookieStoreId) {
return false; return false;
} }
const container = cookieStoreId.replace("firefox-container-", ""); const container = cookieStoreId.replace(BROWSER_NAME + "-container-", "");
if (container !== cookieStoreId) { if (container !== cookieStoreId) {
return container; return container;
} }
@ -324,6 +325,6 @@ const backgroundLogic = {
}, },
cookieStoreId(userContextId) { cookieStoreId(userContextId) {
return `firefox-container-${userContextId}`; return BROWSER_NAME + `-container-${userContextId}`;
} }
}; };