apache / apache/cordova-plugin-inappbrowser

Reopen InAppBrowser with no beforeload don't load url

Open
#774 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

## Problem
I have one instance of cordova InAppBrowser and 2 separate opening settings situations.
Situation A: Open InAppBrowser with settings1.
Situation B: Open InAppBrowser with settings2 ( settings2 = settings1 + 'beforeload=yes' )

### What is expected to happen?
Do Situation B first, open the inAppBrowser, call the beforeload callback then load the url.
Do Situation A second, no beforeload setting found, load the url

### What does actually happen?
Open InAppBrowser with situation B, close it, setting the instance to undefined, then open InAppBrowser with situation A but the link does not load ( situation A doesn't have the beforeload=yes )

## Information

### Command or Code

```
let inAppRef

// this should be needed just for situation B
function beforeLoadCallback(params, callback) {
callback(params.url)
}

function exitCallback() {
inAppRef.removeEventListener('beforeload', exitCallback)
inAppRef.removeEventListener('exit', exitCallback)

inAppRef = undefined
}

function situationA() {
inAppRef = window.Cordova.open('someLink', '_blank',
'location=no,toolbar=no,zoom=no,hardwareback=no,usewkwebview=yes')

inAppRef.addEventListener('exit', exitCallback)
}

function situationB() {
inAppRef = window.Cordova.open('someLink', '_blank',
'location=no,toolbar=no,zoom=no,hardwareback=no,usewkwebview=yes,beforeload=yes')

inAppRef.addEventListener('beforeload', beforeLoadCallback)
inAppRef.addEventListener('exit', exitCallback)
}

// in some other place
situationB() // do some magic in browser => then exit
situationA() // browser hangs and don't load url
```

### Environment, Platform, Device

Android 7.1.4 (emulator)
Android 10 (OnePlus 7T)

### Version information

## Checklist

- [X] I searched for existing GitHub issues
- [X] I updated all Cordova tooling to most recent version
- [X] I included all the necessary information above ( if any more details needed I will add for every question )

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue through the situationB and situationA entry points, using the beforeLoadCallback and exitCallback flow shown in the report. Inspect the Android InAppBrowser handling of beforeload state across closing and reopening; done when Situation A loads its URL after Situation B has been closed.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, javascript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.