[iOS] Fix crash when handling certain types of JS alert info actions

This commit is contained in:
Kyle Hickinson
2024-06-05 20:43:17 -04:00
parent ce224d05a3
commit 1a062afc07
@@ -61,7 +61,7 @@ class JSPromptAlertController: UIAlertController {
weak var delegate: JSPromptAlertControllerDelegate?
private var handledAction: Bool = false
fileprivate var handledAction: Bool = false
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
@@ -102,7 +102,8 @@ struct MessageAlert: JSAlertInfo {
showCancel: false
)
alertController.addAction(
UIAlertAction(title: Strings.OKString, style: .default) { _ in
UIAlertAction(title: Strings.OKString, style: .default) { [weak alertController] _ in
alertController?.handledAction = true
self.completionHandler()
}
)
@@ -128,7 +129,8 @@ struct ConfirmPanelAlert: JSAlertInfo {
info: self
)
alertController.addAction(
UIAlertAction(title: Strings.OKString, style: .default) { _ in
UIAlertAction(title: Strings.OKString, style: .default) { [weak alertController] _ in
alertController?.handledAction = true
self.completionHandler(true)
}
)
@@ -159,7 +161,8 @@ struct TextInputAlert: JSAlertInfo {
input.text = self.defaultText
})
alertController.addAction(
UIAlertAction(title: Strings.OKString, style: .default) { _ in
UIAlertAction(title: Strings.OKString, style: .default) { [weak alertController] _ in
alertController?.handledAction = true
self.completionHandler(input.text)
}
)