mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
use original safari tab if we can
This commit is contained in:
@@ -87,6 +87,8 @@ class BrowserApi {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (BrowserApi.isSafariApi) {
|
} else if (BrowserApi.isSafariApi) {
|
||||||
|
let t = tab.safariTab;
|
||||||
|
if (!t || !t.page) {
|
||||||
const win = safari.application.activeBrowserWindow;
|
const win = safari.application.activeBrowserWindow;
|
||||||
if (safari.application.browserWindows.indexOf(win) !== tab.windowId) {
|
if (safari.application.browserWindows.indexOf(win) !== tab.windowId) {
|
||||||
return Promise.reject('Window not found.');
|
return Promise.reject('Window not found.');
|
||||||
@@ -96,7 +98,9 @@ class BrowserApi {
|
|||||||
return Promise.reject('Tab not found.');
|
return Promise.reject('Tab not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const t = win.tabs[tab.index];
|
t = win.tabs[tab.index];
|
||||||
|
}
|
||||||
|
|
||||||
if (t.page) {
|
if (t.page) {
|
||||||
t.page.dispatchMessage('bitwarden', obj);
|
t.page.dispatchMessage('bitwarden', obj);
|
||||||
}
|
}
|
||||||
@@ -206,6 +210,7 @@ class BrowserApi {
|
|||||||
title: tab.title,
|
title: tab.title,
|
||||||
active: tab === tab.browserWindow.activeTab,
|
active: tab === tab.browserWindow.activeTab,
|
||||||
url: tab.url || 'about:blank',
|
url: tab.url || 'about:blank',
|
||||||
|
safariTab: tab,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||||||
responseCommand: responseCommand
|
responseCommand: responseCommand
|
||||||
});
|
});
|
||||||
safari.self.addEventListener('message', function (msgEvent) {
|
safari.self.addEventListener('message', function (msgEvent) {
|
||||||
var msg = msgEvent.message;
|
const msg = msgEvent.message;
|
||||||
if (msg.command === responseCommand && msg.data === true) {
|
if (msg.command === responseCommand && msg.data === true) {
|
||||||
setInterval(doFillIfNeeded, 500);
|
setInterval(doFillIfNeeded, 500);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user