Merge pull request #621 from jonathanKingston/close-correct-assignment

Close correct assignment window on confirmation page. Fixes #606
This commit is contained in:
luke crouch 2017-06-22 08:16:03 -05:00 committed by GitHub
commit 51b804f96d

View file

@ -56,8 +56,15 @@ function confirmSubmit(redirectUrl, cookieStoreId) {
openInContainer(redirectUrl, cookieStoreId);
}
function getCurrentTab() {
return browser.tabs.query({
active: true,
windowId: browser.windows.WINDOW_ID_CURRENT
});
}
async function denySubmit(redirectUrl) {
const tab = await browser.tabs.query({active: true});
const tab = await getCurrentTab();
await browser.runtime.sendMessage({
method: "exemptContainerAssignment",
tabId: tab[0].id,
@ -73,12 +80,12 @@ async function denySubmit(redirectUrl) {
load();
async function openInContainer(redirectUrl, cookieStoreId) {
const tabs = await browser.tabs.query({active: true});
const tab = await getCurrentTab();
await browser.tabs.create({
cookieStoreId,
url: redirectUrl
});
if (tabs.length > 0) {
browser.tabs.remove(tabs[0].id);
if (tab.length > 0) {
browser.tabs.remove(tab[0].id);
}
}