apache / apache/cordova-plugin-inappbrowser
.open does not support windowFeatures with no `=` in them
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
### What is expected to happen?
`iab.open('https://example.com', '_system', 'noopener')`
opens the webpage
### What does actually happen?
It throws
```java
E/PluginManager: Uncaught exception from plugin
java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:349)
at org.apache.cordova.inappbrowser.InAppBrowser.parseFeature(InAppBrowser.java:447)
at org.apache.cordova.inappbrowser.InAppBrowser.execute(InAppBrowser.java:174)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:174)
at android.os.HandlerThread.run(HandlerThread.java:67)
```
## Information
I believe it is https://github.com/apache/cordova-plugin-inappbrowser/blob/46c080f59a011747ba1b70f462b27fee26957247/src/android/InAppBrowser.java#L436-L456
that expects there to always be an `=` with a value for every windowFeature.
`iab.open('https://example.com', '_system', 'noopener=')` also doesn't work.
I can try to put a PR together that doesn't try and parse out the value when not there but no idea what the implication is.
It does seem like showWebPage just ignores noopener and noreferrer outright https://github.com/apache/cordova-plugin-inappbrowser/blob/46c080f59a011747ba1b70f462b27fee26957247/src/android/InAppBrowser.java#L637
### Command or Code
### Environment, Platform, Device
Android
### Version information
Plugin version 4.0.0
Cordova android 9.0.0
## 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
Contributor guide
Research direction
Start in src/android/InAppBrowser.java at parseFeature around lines 436-456, then inspect showWebPage around line 637. Reproduce the issue with iab.open('https://example.com', '_system', 'noopener') and verify that the call no longer throws and opens the webpage; also check the noopener= variant.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, javascript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100