mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-18 11:05:41 +01:00
receive message from cs scripts
This commit is contained in:
parent
34800cee22
commit
9ab2b6d060
@ -39,10 +39,17 @@ export class SafariApp {
|
||||
}
|
||||
|
||||
private static receiveMessageFromApp(message: any) {
|
||||
if (message == null || message.id == null || !(window as any).bitwardenSafariAppRequests.has(message.id)) {
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
const p = (window as any).bitwardenSafariAppRequests.get(message.id);
|
||||
p.resolve(message.responseData);
|
||||
if (message.id == null && message.command === 'cs_message') {
|
||||
try {
|
||||
const msg = JSON.parse(message.data);
|
||||
SafariApp.sendMessageToListeners(msg, 'cs_message', null);
|
||||
} catch { }
|
||||
} else if (message.id != null && (window as any).bitwardenSafariAppRequests.has(message.id)) {
|
||||
const p = (window as any).bitwardenSafariAppRequests.get(message.id);
|
||||
p.resolve(message.responseData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user