App Crashes After In App Browser Closed


#1

I use inappbrowser to complete oauth2 process in my app. I could run my script successfully in it and get results back but when I call the close function of browser it somehow changes the general behaviour of my app. For example, the next page which has some ion tabs is not rendering data or the second tab is not working anymore. The sample structure of my code is below:

export class SomeComponent implements OnInit {

constructor(...
    private inAppBrowser: InAppBrowser,
    private navController: NavController...) {

}

ngOnInit() {
    let options: InAppBrowserOptions = {
        location: 'no',
        zoom: 'no',
        hidden: 'yes'
    };

    let browser = this.inAppBrowser.create("url", "_self", options);
    browser.on("loadstop").subscribe(event => {
        browser.executeScript({
            code: "mycode"
        }).then(token => {
            //my bussiness logic
            browser.close();
            browser = undefined;

            this.NavController.setRoot(Component)
        })
    })
}