From 344878ef4f0f8999424a340718372646e6f2815e Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Tue, 19 Oct 2021 11:47:25 +0200 Subject: [PATCH] Simplify forwarding tab messages to runtime --- src/content/message_handler.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/content/message_handler.ts b/src/content/message_handler.ts index 361e434fd72..e10834a3d6d 100644 --- a/src/content/message_handler.ts +++ b/src/content/message_handler.ts @@ -21,16 +21,10 @@ window.addEventListener('message', event => { } }, false); +const forwardCommands = ['promptForLogin', 'addToLockedVaultPendingNotifications', 'unlockCompleted']; + chrome.runtime.onMessage.addListener(event => { - if (event.command === 'promptForLogin') { - chrome.runtime.sendMessage(event); - } - - if (event.command === 'addToLockedVaultPendingNotifications') { - chrome.runtime.sendMessage(event); - } - - if (event.command === 'unlockCompleted') { + if (forwardCommands.includes(event.command)) { chrome.runtime.sendMessage(event); } });