Merge pull request #1021 from gaborluk/maintain-tab-active-state

Maintain the active state of the redirected tab
This commit is contained in:
luke crouch 2017-12-04 09:20:02 -06:00 committed by GitHub
commit 4a1597c87f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,7 +144,7 @@ const assignManager = {
return {}; return {};
} }
this.reloadPageInContainer(options.url, userContextId, siteSettings.userContextId, tab.index + 1, siteSettings.neverAsk); this.reloadPageInContainer(options.url, userContextId, siteSettings.userContextId, tab.index + 1, tab.active, siteSettings.neverAsk);
this.calculateContextMenu(tab); this.calculateContextMenu(tab);
/* Removal of existing tabs: /* Removal of existing tabs:
@ -350,13 +350,13 @@ const assignManager = {
}); });
}, },
reloadPageInContainer(url, currentUserContextId, userContextId, index, neverAsk = false) { reloadPageInContainer(url, currentUserContextId, userContextId, index, active, neverAsk = false) {
const cookieStoreId = backgroundLogic.cookieStoreId(userContextId); const cookieStoreId = backgroundLogic.cookieStoreId(userContextId);
const loadPage = browser.extension.getURL("confirm-page.html"); const loadPage = browser.extension.getURL("confirm-page.html");
// False represents assignment is not permitted // False represents assignment is not permitted
// If the user has explicitly checked "Never Ask Again" on the warning page we will send them straight there // If the user has explicitly checked "Never Ask Again" on the warning page we will send them straight there
if (neverAsk) { if (neverAsk) {
browser.tabs.create({url, cookieStoreId, index}); browser.tabs.create({url, cookieStoreId, index, active});
} else { } else {
let confirmUrl = `${loadPage}?url=${this.encodeURLProperty(url)}&cookieStoreId=${cookieStoreId}`; let confirmUrl = `${loadPage}?url=${this.encodeURLProperty(url)}&cookieStoreId=${cookieStoreId}`;
let currentCookieStoreId; let currentCookieStoreId;
@ -367,7 +367,8 @@ const assignManager = {
browser.tabs.create({ browser.tabs.create({
url: confirmUrl, url: confirmUrl,
cookieStoreId: currentCookieStoreId, cookieStoreId: currentCookieStoreId,
index index,
active
}).then(() => { }).then(() => {
// We don't want to sync this URL ever nor clutter the users history // We don't want to sync this URL ever nor clutter the users history
browser.history.deleteUrl({url: confirmUrl}); browser.history.deleteUrl({url: confirmUrl});