breautek commented on issue #1007:
URL: 
https://github.com/apache/cordova-plugin-inappbrowser/issues/1007#issuecomment-1598632140

   I'm not that familiar with this plugin's codebase but did some exploratory 
digging and 
   
   >   at org.apache.cordova.inappbrowser.InAppBrowser$6$1.onPageFinished 
(InAppBrowser.java:534)
   
   Is when it reaches Cordova code, which is a part that calls on the Android 
SDK.
   
   
https://github.com/apache/cordova-plugin-inappbrowser/blob/8ee1d3882163ee1dedb86fb3d0d1f8b7e16c3e42/src/android/InAppBrowser.java#L532-L540
   
   Line 534 is the code entering the `onPageFinished` callback, in which 
Cordova tests for an existence of and attempts to `dismiss()` an 
[android.app.Dialog](https://developer.android.com/reference/android/app/Dialog#dismiss()).
   
   The Android SDK claims that:
   
   > This method can be invoked safely from any thread.
   
   and doesn't document any other causes for an `IllegalArgumentException`.
   
   I however did find hints at 
[SO](https://stackoverflow.com/questions/39640140/java-lang-illegalargumentexception-dialog-dismiss)
 that suggest that this exception will raise if attempting to `dismiss` a 
dialog when the `Dialog` is already destroyed. I think we protect ourselves by 
explicitly setting the `dialog` to `null` after we dismiss it, but this might 
not be sufficient as there are likely other user actions that can happen that 
can cause a dialog to be dismissed.
   
   I think test code needs to be added to confirm that double-dismissing a 
dialog (or at least attempting to dismiss it while `isShowing()` is false) will 
trigger this kind of error. If it does, then adding a `isShowing()` condition 
check before dismissing might be a solution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to