1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-29 11:05:54 +02:00
bitwarden-browser/apps/browser/src/autofill/content/message_handler.ts
Thomas Rittson f592963191
[EC-475] Auto-save password prompt enhancements (#4808)
* [EC-1062] Convert bar.js to TS and refactor (#4623)

* [EC-476 / EC-478] Add notificationBar edit flow (#4626)

* [EC-477] Enable auto-save for users without individual vault (#4760)

* [EC-1057] Add data loss warning to notificationBar edit flow (#4761)

* [AC-1173] Fix state bugs in auto-save edit flow (#4936)

---------

Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
2023-03-09 08:12:43 +10:00

42 lines
978 B
TypeScript

window.addEventListener(
"message",
(event) => {
if (event.source !== window) {
return;
}
if (event.data.command && event.data.command === "authResult") {
chrome.runtime.sendMessage({
command: event.data.command,
code: event.data.code,
state: event.data.state,
referrer: event.source.location.hostname,
});
}
if (event.data.command && event.data.command === "webAuthnResult") {
chrome.runtime.sendMessage({
command: event.data.command,
data: event.data.data,
remember: event.data.remember,
referrer: event.source.location.hostname,
});
}
},
false
);
const forwardCommands = [
"promptForLogin",
"addToLockedVaultPendingNotifications",
"unlockCompleted",
"addedCipher",
"openAddEditCipher",
];
chrome.runtime.onMessage.addListener((event) => {
if (forwardCommands.includes(event.command)) {
chrome.runtime.sendMessage(event);
}
});