mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-01 00:10:39 +02:00
bitwarden frame id for safari autofills
This commit is contained in:
parent
82d14750e7
commit
1f361bc091
|
@ -120,6 +120,10 @@ export class BrowserApi {
|
|||
delete obj.tab.safariTab;
|
||||
}
|
||||
|
||||
if (options != null && options.frameId != null && obj.bitwardenFrameId == null) {
|
||||
obj.bitwardenFrameId = options.frameId;
|
||||
}
|
||||
|
||||
if (t.page) {
|
||||
t.page.dispatchMessage('bitwarden', obj);
|
||||
}
|
||||
|
@ -199,7 +203,8 @@ export class BrowserApi {
|
|||
safari.application.addEventListener('message', async (msgEvent: any) => {
|
||||
callback(msgEvent.message, {
|
||||
tab: BrowserApi.makeTabObject(msgEvent.target),
|
||||
frameId: null,
|
||||
frameId: msgEvent.message != null && msgEvent.message.bitwardenFrameId != null ?
|
||||
msgEvent.message.bitwardenFrameId : null,
|
||||
}, () => { /* No responses in Safari */ });
|
||||
}, false);
|
||||
}
|
||||
|
|
|
@ -986,8 +986,15 @@
|
|||
|
||||
if ((typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') === -1) {
|
||||
if (window.__bitwardenFrameId == null) {
|
||||
window.__bitwardenFrameId = Math.floor(Math.random() * Math.floor(99999999));
|
||||
}
|
||||
safari.self.addEventListener('message', function (msgEvent) {
|
||||
var msg = msgEvent.message;
|
||||
if(msg.bitwardenFrameId != null && window.__bitwardenFrameId !== msg.bitwardenFrameId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.command === 'collectPageDetails') {
|
||||
var pageDetails = collect(document);
|
||||
var pageDetailsObj = JSON.parse(pageDetails);
|
||||
|
@ -995,7 +1002,8 @@
|
|||
command: 'collectPageDetailsResponse',
|
||||
tab: msg.tab,
|
||||
details: pageDetailsObj,
|
||||
sender: msg.sender
|
||||
sender: msg.sender,
|
||||
bitwardenFrameId: window.__bitwardenFrameId
|
||||
});
|
||||
}
|
||||
else if (msg.command === 'fillForm') {
|
||||
|
|
Loading…
Reference in New Issue
Block a user