Skip to content

Commit

Permalink
Maintain the active state of the redirected tab
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborluk committed Dec 2, 2017
1 parent ef45cde commit f87bf2a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions webextension/js/background/assignManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const assignManager = {
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);

/* Removal of existing tabs:
Expand Down Expand Up @@ -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 loadPage = browser.extension.getURL("confirm-page.html");
// 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 (neverAsk) {
browser.tabs.create({url, cookieStoreId, index});
browser.tabs.create({url, cookieStoreId, index, active});
} else {
let confirmUrl = `${loadPage}?url=${this.encodeURLProperty(url)}&cookieStoreId=${cookieStoreId}`;
let currentCookieStoreId;
Expand All @@ -367,7 +367,8 @@ const assignManager = {
browser.tabs.create({
url: confirmUrl,
cookieStoreId: currentCookieStoreId,
index
index,
active
}).then(() => {
// We don't want to sync this URL ever nor clutter the users history
browser.history.deleteUrl({url: confirmUrl});
Expand Down

0 comments on commit f87bf2a

Please sign in to comment.