mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 07:13:32 +00:00
Potential fix for pinned tab auto-fill in Safari
This commit is contained in:
@@ -70,11 +70,26 @@ func makeSenderTabObject(page: SFSafariPage, props: SFSafariPageProperties?, com
|
|||||||
t.url = props?.url?.absoluteString
|
t.url = props?.url?.absoluteString
|
||||||
page.getContainingTab { tab in
|
page.getContainingTab { tab in
|
||||||
tab.getContainingWindow(completionHandler: { win in
|
tab.getContainingWindow(completionHandler: { win in
|
||||||
win?.getActiveTab(completionHandler: { activeTab in
|
guard let window = win else {
|
||||||
|
t.active = false;
|
||||||
|
t.windowId = -100
|
||||||
|
SFSafariApplication.getAllWindows(completionHandler: { allWins in
|
||||||
|
if (allWins.count == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
allWins[0].getAllTabs { allWinTabs in
|
||||||
|
t.index = allWinTabs.firstIndex(of: tab) ?? -1
|
||||||
|
t.id = "\(t.windowId)_\(t.index)"
|
||||||
|
complete(t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.getActiveTab(completionHandler: { activeTab in
|
||||||
t.active = activeTab != nil && tab == activeTab
|
t.active = activeTab != nil && tab == activeTab
|
||||||
SFSafariApplication.getAllWindows(completionHandler: { allWins in
|
SFSafariApplication.getAllWindows(completionHandler: { allWins in
|
||||||
t.windowId = allWins.firstIndex(of: win!) ?? -100
|
t.windowId = allWins.firstIndex(of: window) ?? -100
|
||||||
win!.getAllTabs { allWinTabs in
|
window.getAllTabs { allWinTabs in
|
||||||
t.index = allWinTabs.firstIndex(of: tab) ?? -1
|
t.index = allWinTabs.firstIndex(of: tab) ?? -1
|
||||||
t.id = "\(t.windowId)_\(t.index)"
|
t.id = "\(t.windowId)_\(t.index)"
|
||||||
complete(t)
|
complete(t)
|
||||||
|
|||||||
Reference in New Issue
Block a user