Remove unnecessary menu awaits

This commit is contained in:
hensm
2020-02-12 00:07:03 +00:00
parent 4d6e59ec68
commit 7b4b0660fe

View File

@@ -110,13 +110,13 @@ async function initMenus () {
const opts = await options.getAll(); const opts = await options.getAll();
// Global "Cast..." menu item // Global "Cast..." menu item
menuIdCast = await browser.menus.create({ menuIdCast = browser.menus.create({
contexts: [ "browser_action", "page", "tools_menu" ] contexts: [ "browser_action", "page", "tools_menu" ]
, title: _("contextCast") , title: _("contextCast")
}); });
// <video>/<audio> "Cast..." context menu item // <video>/<audio> "Cast..." context menu item
menuIdMediaCast = await browser.menus.create({ menuIdMediaCast = browser.menus.create({
contexts: [ "audio", "video" ] contexts: [ "audio", "video" ]
, title: _("contextCast") , title: _("contextCast")
, visible: opts.mediaEnabled , visible: opts.mediaEnabled
@@ -126,18 +126,18 @@ async function initMenus () {
}); });
menuIdWhitelist = await browser.menus.create({ menuIdWhitelist = browser.menus.create({
contexts: [ "browser_action" ] contexts: [ "browser_action" ]
, title: _("contextAddToWhitelist") , title: _("contextAddToWhitelist")
, enabled: false , enabled: false
}); });
menuIdWhitelistRecommended = await browser.menus.create({ menuIdWhitelistRecommended = browser.menus.create({
title: _("contextAddToWhitelistRecommended") title: _("contextAddToWhitelistRecommended")
, parentId: menuIdWhitelist , parentId: menuIdWhitelist
}); });
await browser.menus.create({ browser.menus.create({
type: "separator" type: "separator"
, parentId: menuIdWhitelist , parentId: menuIdWhitelist
}); });
@@ -319,7 +319,7 @@ async function initMenus () {
if (url.search) { if (url.search) {
const whitelistSearchMenuId = await browser.menus.create({ const whitelistSearchMenuId = browser.menus.create({
title: _("contextAddToWhitelistAdvancedAdd", patternSearch) title: _("contextAddToWhitelistAdvancedAdd", patternSearch)
, parentId: menuIdWhitelist , parentId: menuIdWhitelist
}); });
@@ -351,7 +351,7 @@ async function initMenus () {
const pattern = `${url.origin}/${partialPath}/*`; const pattern = `${url.origin}/${partialPath}/*`;
const partialPathMenuId = await browser.menus.create({ const partialPathMenuId = browser.menus.create({
title: _("contextAddToWhitelistAdvancedAdd", pattern) title: _("contextAddToWhitelistAdvancedAdd", pattern)
, parentId: menuIdWhitelist , parentId: menuIdWhitelist
}); });
@@ -363,7 +363,7 @@ async function initMenus () {
} }
const wildcardProtocolMenuId = await browser.menus.create({ const wildcardProtocolMenuId = browser.menus.create({
title: _("contextAddToWhitelistAdvancedAdd" title: _("contextAddToWhitelistAdvancedAdd"
, patternWildcardProtocol) , patternWildcardProtocol)
, parentId: menuIdWhitelist , parentId: menuIdWhitelist
@@ -373,7 +373,7 @@ async function initMenus () {
wildcardProtocolMenuId, patternWildcardProtocol); wildcardProtocolMenuId, patternWildcardProtocol);
const wildcardSubdomainMenuId = await browser.menus.create({ const wildcardSubdomainMenuId = browser.menus.create({
title: _("contextAddToWhitelistAdvancedAdd" title: _("contextAddToWhitelistAdvancedAdd"
, patternWildcardSubdomain) , patternWildcardSubdomain)
, parentId: menuIdWhitelist , parentId: menuIdWhitelist
@@ -383,7 +383,7 @@ async function initMenus () {
wildcardSubdomainMenuId, patternWildcardSubdomain); wildcardSubdomainMenuId, patternWildcardSubdomain);
const wildcardProtocolAndSubdomainMenuId = await browser.menus.create({ const wildcardProtocolAndSubdomainMenuId = browser.menus.create({
title: _("contextAddToWhitelistAdvancedAdd" title: _("contextAddToWhitelistAdvancedAdd"
, patternWildcardProtocolAndSubdomain) , patternWildcardProtocolAndSubdomain)
, parentId: menuIdWhitelist , parentId: menuIdWhitelist