1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-26 18:04:07 +01:00

Potential fix for pinned tab auto-fill in Safari

This commit is contained in:
Chad Scharf 2020-09-21 12:53:51 -04:00
parent 5ec2a70027
commit c4e66ce587

View File

@ -70,11 +70,26 @@ func makeSenderTabObject(page: SFSafariPage, props: SFSafariPageProperties?, com
t.url = props?.url?.absoluteString
page.getContainingTab { tab 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
SFSafariApplication.getAllWindows(completionHandler: { allWins in
t.windowId = allWins.firstIndex(of: win!) ?? -100
win!.getAllTabs { allWinTabs in
t.windowId = allWins.firstIndex(of: window) ?? -100
window.getAllTabs { allWinTabs in
t.index = allWinTabs.firstIndex(of: tab) ?? -1
t.id = "\(t.windowId)_\(t.index)"
complete(t)