Fixed Assignement Toast on page.

Now opens in the newly opened tab (after it has been reopened
in the correct container). It also does not provide a toast
when removing sites from the edit assignments panel, becuase
user will most likely not be on that site when editing the
panel, so it has been throwing an error. Error should go away.
This commit is contained in:
Kendall Werts
2020-02-27 08:42:27 -06:00
parent 0290eb1d56
commit 8ef5cbd81b
4 changed files with 53 additions and 29 deletions
+17 -14
View File
@@ -90,8 +90,8 @@ const Utils = {
});
},
reloadInContainer(url, currentUserContextId, newUserContextId, tabIndex, active) {
return browser.runtime.sendMessage({
async reloadInContainer(url, currentUserContextId, newUserContextId, tabIndex, active) {
return await browser.runtime.sendMessage({
method: "reloadInContainer",
url,
currentUserContextId,
@@ -102,21 +102,24 @@ const Utils = {
},
async alwaysOpenInContainer(identity) {
const currentTab = await this.currentTab();
let currentTab = await this.currentTab();
const assignedUserContextId = this.userContextId(identity.cookieStoreId);
Utils.setOrRemoveAssignment(
currentTab.id,
currentTab.url,
assignedUserContextId,
false
);
if (currentTab.cookieStoreId !== identity.cookieStoreId) {
Utils.reloadInContainer(
return await browser.runtime.sendMessage({
method: "assignAndReloadInContainer",
url: currentTab.url,
currentUserContextId: false,
newUserContextId: assignedUserContextId,
tabIndex: currentTab.index +1,
active:currentTab.active
});
} else {
currentTab = await this.currentTab();
Utils.setOrRemoveAssignment(
currentTab.id,
currentTab.url,
false,
assignedUserContextId,
currentTab.index + 1,
currentTab.active
assignedUserContextId,
false
);
}
}