[Webkit-unassigned] [Bug 184144] Reproducible, recurring crash when the completion handler passed to -[runJavaScriptAlertPanelWithMessage:initiatedByFrame: completionHandler:] is deallocated without being called once

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 11 10:53:52 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=184144

AV <aravindv2007 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |---

--- Comment #9 from AV <aravindv2007 at gmail.com> ---
Thank you so much, Andy.

I get the solution. I know there is a way to handle this as I mentioned in my 2nd comment, by manually keeping track of the instances of all alerts and their respective completion handlers and call each of these completion handlers one by one when the app needs to be de-allocated for a valid reason.

Let's assume the following scenario:

1) I have an application that has an in-built secure browser built on top of WebKit, which gets locked when the app enters into the background. When locking, if the webkit instance is maintained and the alerts aren't dismissed, the alerts will show-up on top of the app's lock screen(or on top of whichever view is currently being rendered), which is not a good user experience.

2) In the last few versions of iOS, UIAlertView is deprecated and Apple suggests developers to use UIAlertController. UIAlertController doesn't have a method similar to UIAlertView's "dismissWithClickedButtonIndex: animated:(BOOL)animated". Hence, the best way to work-around on this is to use UIAlertView and dismiss alerts whenever necessary by calling "dismissWithClickedButtonIndex: animated:(BOOL)animated", but this is ruled-out as UIAlertView is deprecated.

3) The only other possible way, as I've mentioned in my previous comments, is to maintain a list of all active Alerts by adding each alert instance and it's respective completion-handlers as and when the JS Alert delegate methods get called, and traversing through the list maintained and calling all active alerts' completion-handlers manually. This works, but seems to be a complex workaround.


Can you please advice as to whether the work-around mentioned in "3)" is the only way to deal with this? If so, it piles-up the code for just dismissing the active alerts by maintaining the state of each active alert. Though UIAlertView's "dismissWithClickedButtonIndex: animated:(BOOL)animated" would work well, it may not be advisable as Apple has already deprecated and may soon remove UIAlertView from it's SDK soon in the future.

Please if there is a possible fix or a better work-around for this, or if WebKit already has methods exposed to clear pending completion handlers before dismissing the alerts using "dismissViewController".


Thank you you much for your support.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180411/d703da6e/attachment-0002.html>


More information about the webkit-unassigned mailing list