apache / apache/cordova-plugin-inappbrowser
iOS: Inappbrowser close method successcallback called before the inappbrowser viewcontroller is actually dismissed
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
In cordova inappbrowser ios implementation, after presenting an inappbrowser viewcontroller, the javascript code can call close method to close it, then immediately present another inappbrowser viewcontroller.
Basically the javascript code starts the second inappbrowser instance in the first inappbrowser's close's successcallback method.
However, with the current ios implementation, the close method's successcallback is called in browserExit method. At that moment, the inappbrowser viewcontroller may not yet be dismissed, as a result, opening the second inappbrowser viewcontroller may fail randomly due to this timing issue.
One possible solution is, instead of calling the close methods' succcesscallback from the browserExit method, it can be called on inappbrowser's dismissViewControllerAnimated's completion block. At that moment, the current inappbrowser is already dismissed, and it is safe to open a new inappbrowser instance.
Contributor guide
Research direction
Start in the iOS implementation at browserExit and trace the close method's successcallback through dismissViewControllerAnimated. Verify the callback timing against the dismissal completion block, then reproduce the sequence where JavaScript closes one inappbrowser and immediately opens another; done means the second viewcontroller opens reliably after the first is dismissed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, objective-c
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100