Giter Site home page Giter Site logo

Comments (1)

breautek avatar breautek commented on May 24, 2024

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.

childView.setWebViewClient(new WebViewClient() {
// NB: wait for about:blank before dismissing
public void onPageFinished(WebView view, String url) {
if (dialog != null && !cordova.getActivity().isFinishing()) {
dialog.dismiss();
dialog = null;
}
}
});

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.

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 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.

And if Cordova needs to clean up anything(like setting the dialog to null), I think the onStop hook should be used.

from cordova-plugin-inappbrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.