[PM-5639] Fix Safari Window Popouts Issues When Manually Locking Extension (#7953)

* [PM-5639] Safari Browser Shows Issues When Manually Locking Extension

* [PM-5639] Safari Browser Shows Issues When Manually Locking Extension
This commit is contained in:
Cesar Gonzalez 2024-02-15 12:10:45 -06:00 committed by GitHub
parent b46eb274bb
commit caa998c5b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 7 deletions

View File

@ -34,9 +34,9 @@ const windowMessageHandlers: ContentMessageWindowEventHandlers = {
* @param data - Data from the window message * @param data - Data from the window message
* @param referrer - The referrer of the window * @param referrer - The referrer of the window
*/ */
async function handleAuthResultMessage(data: ContentMessageWindowData, referrer: string) { function handleAuthResultMessage(data: ContentMessageWindowData, referrer: string) {
const { command, lastpass, code, state } = data; const { command, lastpass, code, state } = data;
await chrome.runtime.sendMessage({ command, code, state, lastpass, referrer }); sendExtensionRuntimeMessage({ command, code, state, lastpass, referrer });
} }
/** /**
@ -47,7 +47,7 @@ async function handleAuthResultMessage(data: ContentMessageWindowData, referrer:
*/ */
async function handleDuoResultMessage(data: ContentMessageWindowData, referrer: string) { async function handleDuoResultMessage(data: ContentMessageWindowData, referrer: string) {
const { command, code, state } = data; const { command, code, state } = data;
await chrome.runtime.sendMessage({ command, code, state, referrer }); sendExtensionRuntimeMessage({ command, code, state, referrer });
} }
/** /**
@ -56,9 +56,9 @@ async function handleDuoResultMessage(data: ContentMessageWindowData, referrer:
* @param data - Data from the window message * @param data - Data from the window message
* @param referrer - The referrer of the window * @param referrer - The referrer of the window
*/ */
async function handleWebAuthnResultMessage(data: ContentMessageWindowData, referrer: string) { function handleWebAuthnResultMessage(data: ContentMessageWindowData, referrer: string) {
const { command, remember } = data; const { command, remember } = data;
await chrome.runtime.sendMessage({ command, data: data.data, remember, referrer }); sendExtensionRuntimeMessage({ command, data: data.data, remember, referrer });
} }
/** /**
@ -96,12 +96,23 @@ const forwardCommands = new Set([
* *
* @param message - The message from the extension * @param message - The message from the extension
*/ */
async function handleExtensionMessage(message: any) { function handleExtensionMessage(message: any) {
if (forwardCommands.has(message.command)) { if (forwardCommands.has(message.command)) {
await chrome.runtime.sendMessage(message); sendExtensionRuntimeMessage(message);
} }
} }
/**
* Sends a message to the extension runtime, and ignores
* any potential promises that should be handled using
* the `void` operator.
*
* @param message - The message to send to the extension runtime
*/
function sendExtensionRuntimeMessage(message: any) {
void chrome.runtime.sendMessage(message);
}
/** /**
* Duplicate implementation of the same named method within `apps/browser/src/autofill/utils/index.ts`. * Duplicate implementation of the same named method within `apps/browser/src/autofill/utils/index.ts`.
* This is done due to some strange observed compilation behavior present when importing the method from * This is done due to some strange observed compilation behavior present when importing the method from