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
+18 -4
View File
@@ -6,8 +6,9 @@ const messageHandler = {
init() {
// Handles messages from webextension code
browser.runtime.onMessage.addListener((m) => {
browser.runtime.onMessage.addListener(async (m) => {
let response;
let tab;
switch (m.method) {
case "getShortcuts":
@@ -43,9 +44,7 @@ const messageHandler = {
case "setOrRemoveAssignment":
// m.tabId is used for where to place the in content message
// m.url is the assignment to be removed/added
response = browser.tabs.get(m.tabId).then((tab) => {
return assignManager._setOrRemoveAssignment(tab.id, m.url, m.userContextId, m.value);
});
response = assignManager._setOrRemoveAssignment(m.tabId, m.url, m.userContextId, m.value);
break;
case "sortTabs":
backgroundLogic.sortTabs();
@@ -90,6 +89,21 @@ const messageHandler = {
true
);
break;
case "assignAndReloadInContainer":
tab = await assignManager.reloadPageInContainer(
m.url,
m.currentUserContextId,
m.newUserContextId,
m.tabIndex,
m.active,
true
);
// m.tabId is used for where to place the in content message
// m.url is the assignment to be removed/added
response = browser.tabs.get(tab.id).then((tab) => {
return assignManager._setOrRemoveAssignment(tab.id, m.url, m.newUserContextId, m.value);
});
break;
}
console.log(m.method, "response", response);
return response;