1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

Merge pull request #1399 from bitwarden/fix/no-autofill-from-pinned-tab-in-safari

Potential fix for pinned tab auto-fill in Safari
This commit is contained in:
Chad Scharf 2020-09-22 10:03:39 -04:00 committed by GitHub
commit af0891fb03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)