mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PM-2560] Fix Firefox default passkeys handling (#5690)
* Return callback response in addListener * Add clarifying comment * Isolate returning the callback to fido2 commands * Update apps/browser/src/platform/browser/browser-api.ts Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com> * Fix formatting --------- Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
This commit is contained in:
@@ -184,7 +184,18 @@ export class BrowserApi {
|
||||
name: string,
|
||||
callback: (message: any, sender: chrome.runtime.MessageSender, response: any) => unknown
|
||||
) {
|
||||
chrome.runtime.onMessage.addListener(callback);
|
||||
chrome.runtime.onMessage.addListener(
|
||||
(msg: any, sender: chrome.runtime.MessageSender, sendResponse: any) => {
|
||||
const messageResponse = callback(msg, sender, sendResponse);
|
||||
|
||||
if (!messageResponse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Promise.resolve(messageResponse);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
// Keep track of all the events registered in a Safari popup so we can remove
|
||||
// them when the popup gets unloaded, otherwise we cause a memory leak
|
||||
|
||||
Reference in New Issue
Block a user