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
+16 -9
View File
@@ -500,16 +500,23 @@ window.assignManager = {
userContextId,
neverAsk: false
}, exemptedTabIds);
actionName = "added";
actionName = "assigned site to always open in this container";
} else {
await this.storageArea.remove(pageUrl);
actionName = "removed";
actionName = "removed from assigned sites list";
}
if (tabId) {
const tab = await browser.tabs.get(tabId);
setTimeout(function(){
browser.tabs.sendMessage(tabId, {
text: `Successfully ${actionName}`
});
}, 1000);
this.calculateContextMenu(tab);
}
browser.tabs.sendMessage(tabId, {
text: `Successfully ${actionName} site to always open in this container`
});
const tab = await browser.tabs.get(tabId);
this.calculateContextMenu(tab);
},
async _getAssignment(tab) {
@@ -595,7 +602,7 @@ window.assignManager = {
// 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, active, openerTabId});
return browser.tabs.create({url, cookieStoreId, index, active, openerTabId});
} else {
let confirmUrl = `${loadPage}?url=${this.encodeURLProperty(url)}&cookieStoreId=${cookieStoreId}`;
let currentCookieStoreId;
@@ -603,7 +610,7 @@ window.assignManager = {
currentCookieStoreId = backgroundLogic.cookieStoreId(currentUserContextId);
confirmUrl += `&currentCookieStoreId=${currentCookieStoreId}`;
}
browser.tabs.create({
return browser.tabs.create({
url: confirmUrl,
cookieStoreId: currentCookieStoreId,
openerTabId,