mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
send message to safari tab for autofill
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
!(function () {
|
||||
!(function () {
|
||||
/*
|
||||
1Password Extension
|
||||
|
||||
@@ -994,6 +994,26 @@
|
||||
End 1Password Extension
|
||||
*/
|
||||
|
||||
if ((typeof safari !== 'undefined')) {
|
||||
safari.self.addEventListener('bitwarden', function (msgEvent) {
|
||||
var msg = msgEvent.message;
|
||||
if (msg.command === 'collectPageDetails') {
|
||||
var pageDetails = collect(document);
|
||||
var pageDetailsObj = JSON.parse(pageDetails);
|
||||
safari.self.tab.dispatchMessage('bitwarden', {
|
||||
command: 'collectPageDetailsResponse',
|
||||
tab: msg.tab,
|
||||
details: pageDetailsObj,
|
||||
sender: msg.sender
|
||||
});
|
||||
}
|
||||
else if (msg.command === 'fillForm') {
|
||||
fill(document, msg.fillScript);
|
||||
}
|
||||
}, false);
|
||||
return;
|
||||
}
|
||||
|
||||
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
|
||||
if (msg.command === 'collectPageDetails') {
|
||||
var pageDetails = collect(document);
|
||||
|
||||
Reference in New Issue
Block a user