diff --git a/lib/environment/background/pageAction.js b/lib/environment/background/pageAction.js index 2a10bb8f3b..55fa678017 100644 --- a/lib/environment/background/pageAction.js +++ b/lib/environment/background/pageAction.js @@ -3,13 +3,13 @@ import { addListener, sendMessage } from './messaging'; (process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).onClicked.addListener(tab => { - sendMessage((process.env.BUILD_TARGET === 'firefox' ? 'pageActionClick' : 'actionClick'), undefined, tab.id); + sendMessage('pageActionClick', undefined, tab.id); }); -addListener((process.env.BUILD_TARGET === 'firefox' ? 'pageAction' : 'action'), ({ operation, state }, { tab }) => { +addListener('pageAction', ({ operation, state }, { tab }) => { switch (operation) { case 'show': - (process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).show(tab.id); + (process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction.show : chrome.action.enable)(tab.id); (process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).setIcon({ tabId: tab.id, path: { @@ -23,7 +23,7 @@ addListener((process.env.BUILD_TARGET === 'firefox' ? 'pageAction' : 'action'), }); break; case 'hide': - (process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).hide(tab.id); + (process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction.hide : chrome.action.disable)(tab.id); break; default: throw new Error(`Invalid action operation: ${operation}`);