Skip to content

Commit

Permalink
support multi account containers
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Cristian Petcu committed Aug 18, 2019
1 parent 68f6de8 commit ae1d150
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions scripts/StorageService.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ class StorageService {
return domainData.hasCSP;
}

static async setLangCookie(domain) {
static async setLangCookie(domain, storeId) {
const langCookie = await getGoogtransCookie();
browser.cookies.set({
await browser.cookies.set({
url: domain,
name: "googtrans",
value: langCookie.value
value: langCookie.value,
storeId
});
}

Expand Down
12 changes: 6 additions & 6 deletions scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ function getDomain(url) {
}

function translateTab(tabId) {
setTimeout(function () {
browser.tabs.get(tabId).then(function (tabInfo) {
StorageService.setLangCookie(tabInfo.url);
browser.tabs.executeScript(tabId, {
browser.tabs.get(tabId).then(async function (tabInfo) {
await StorageService.setLangCookie(tabInfo.url, tabInfo.cookieStoreId);
setTimeout(function () {
return browser.tabs.executeScript(tabId, {
file: 'scripts/inject_google_translate_content.js'
});
});
}, 250);
}, 250);
});
}

async function updateMenuForDomain() {
Expand Down

0 comments on commit ae1d150

Please sign in to comment.