mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
Potential fix for swift nil unwrap exception
This commit is contained in:
parent
9f024828f2
commit
e12cce711c
@ -101,10 +101,19 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
|||||||
let options: TabQueryOptions? = jsonDeserialize(json: m!.data)
|
let options: TabQueryOptions? = jsonDeserialize(json: m!.data)
|
||||||
if options?.currentWindow ?? false {
|
if options?.currentWindow ?? false {
|
||||||
SFSafariApplication.getActiveWindow { win in
|
SFSafariApplication.getActiveWindow { win in
|
||||||
processWindowsForTabs(wins: [win!], options: options, complete: { tabs in
|
if win != nil {
|
||||||
m!.responseData = jsonSerialize(obj: tabs)
|
processWindowsForTabs(wins: [win!], options: options, complete: { tabs in
|
||||||
self.replyMessage(message: m!)
|
m!.responseData = jsonSerialize(obj: tabs)
|
||||||
})
|
self.replyMessage(message: m!)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
SFSafariApplication.getAllWindows { wins in
|
||||||
|
processWindowsForTabs(wins: wins, options: options, complete: { tabs in
|
||||||
|
m!.responseData = jsonSerialize(obj: tabs)
|
||||||
|
self.replyMessage(message: m!)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SFSafariApplication.getAllWindows { wins in
|
SFSafariApplication.getAllWindows { wins in
|
||||||
@ -145,10 +154,12 @@ class SafariExtensionViewController: SFSafariExtensionViewController, WKScriptMe
|
|||||||
dismissPopover()
|
dismissPopover()
|
||||||
replyMessage(message: m!)
|
replyMessage(message: m!)
|
||||||
} else if command == "showPopover" {
|
} else if command == "showPopover" {
|
||||||
SFSafariApplication.getActiveWindow { win in
|
if popoverOpenCount <= 0 {
|
||||||
win?.getToolbarItem(completionHandler: { item in
|
SFSafariApplication.getActiveWindow { win in
|
||||||
item?.showPopover()
|
win?.getToolbarItem(completionHandler: { item in
|
||||||
})
|
item?.showPopover()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if command == "isPopoverOpen" {
|
} else if command == "isPopoverOpen" {
|
||||||
m!.responseData = popoverOpenCount > 0 ? "true" : "false"
|
m!.responseData = popoverOpenCount > 0 ? "true" : "false"
|
||||||
|
Loading…
Reference in New Issue
Block a user