Use await instead of then()
This commit is contained in:
parent
884b55c679
commit
628e85b81d
1 changed files with 15 additions and 9 deletions
|
@ -184,18 +184,15 @@ const assignManager = {
|
||||||
const reopenCookieStoreId = this.menuId2cookieStoreId(info.menuItemId);
|
const reopenCookieStoreId = this.menuId2cookieStoreId(info.menuItemId);
|
||||||
|
|
||||||
if (reopenCookieStoreId) {
|
if (reopenCookieStoreId) {
|
||||||
browser.tabs.create({
|
const newTab = await browser.tabs.create({
|
||||||
active: info.frameId !== undefined,
|
active: info.frameId !== undefined,
|
||||||
cookieStoreId: reopenCookieStoreId,
|
cookieStoreId: reopenCookieStoreId,
|
||||||
index: tab.index + 1,
|
index: tab.index + 1,
|
||||||
openerTabId: tab.openerTabId,
|
openerTabId: tab.openerTabId,
|
||||||
pinned: tab.pinned,
|
pinned: tab.pinned,
|
||||||
url: tab.url,
|
url: tab.url,
|
||||||
}).then(() => {
|
|
||||||
browser.tabs.remove(tab.id);
|
|
||||||
}).catch((e) => {
|
|
||||||
throw e;
|
|
||||||
});
|
});
|
||||||
|
browser.tabs.remove(tab.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,10 +373,19 @@ const assignManager = {
|
||||||
parentId: this.MENU_RELOAD_IN,
|
parentId: this.MENU_RELOAD_IN,
|
||||||
});
|
});
|
||||||
|
|
||||||
const identities = await browser.contextualIdentities.query({});
|
let identities;
|
||||||
identities.forEach((identity) => {
|
try {
|
||||||
this.addContainerMenuEntry(identity, (identity.cookieStoreId !== tab.cookieStoreId) ?
|
identities = await browser.contextualIdentities.query({});
|
||||||
["all", "tab"] : ["tab"]);
|
} catch (e) {
|
||||||
|
identities = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
identities.forEach(async (identity) => {
|
||||||
|
if (identity.cookieStoreId === tab.cookieStoreId) {
|
||||||
|
this.addReloadMenuEntry(identity, ["tab"], false);
|
||||||
|
} else {
|
||||||
|
this.addReloadMenuEntry(identity, ["all", "tab"], false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const siteSettings = await this._getAssignment(tab);
|
const siteSettings = await this._getAssignment(tab);
|
||||||
|
|
Loading…
Add table
Reference in a new issue