-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Bug Report
Problem
If multiple instances of IAB are created, only the events from the last created IAB instances are called back.
What does actually happen?
Consider, we create one InAppBrowser-
const inAppBrowserRef1 = cordova.InAppBrowser.open('http://example.com', '_blank', 'location=yes');
inAppBrowserRef1.addEventListener('loadstart', loadStartCallBack);
inAppBrowserRef1.addEventListener('exit', loadExitCallBack);
inAppBrowserRef1.addEventListener('message', messageCallBack);All the callback works fine. Now, while this IAB is open and we launch another IAB with target as _system-
const inAppBrowserRef2 = cordova.InAppBrowser.open('http://google.com', '_system');
inAppBrowserRef2.addEventListener('loadstart', loadStartCallBack);
inAppBrowserRef2.addEventListener('exit', loadExitCallBack);
inAppBrowserRef2.addEventListener('message', messageCallBack);After this code is executed, all the event listeners on inAppBrowserRef1 stop working and instead they start to execute on inAppBrowserRef2 listeners for the first IAB instance.
What is expected to happen?
Event callbacks on inAppBrowserRef1 should work irrespective of other IAB i.e. inAppBrowserRef2.
Information
Came to know about this problem while implementing message listeners and I was able to listen the message events only once as described here https://gist.github.com/sagrawal31/9004198ae56a58ff235ce0f1dd62362c
Command or Code
Already shared the code above.
Environment, Platform, Device, Version information
- Cordova- 9.0.0 (cordova-lib@9.0.1)
- cordova-android- 8.1.0 & 9.0.0
- Android OS- Samsung UI 2.0 (Android 10)
- Plugin version- ^4.0.0
- OS- macOS Catalina
- Tested on a fresh/empty Cordova app
- Android Studio- 4
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above