Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebView still visible in chrome://inspect after page is destroyed #2053

Closed
bfattori opened this issue Apr 28, 2016 · 2 comments · Fixed by #2068
Closed

WebView still visible in chrome://inspect after page is destroyed #2053

bfattori opened this issue Apr 28, 2016 · 2 comments · Fixed by #2068

Comments

@bfattori
Copy link

Did you verify this is a real problem by searching [Stack Overflow]

Yes

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 1.7.1
  • Cross-platform modules: 1.7.1
  • Runtime(s): tns-ios: 1.6.0 tns-android: 1.7.1
  • Plugin(s):
    "nativescript-webview-interface": "^1.2.0",

Please tell us how to recreate the issue in as much detail as possible.

Create a webView on a page, dynamically (e.g. Not using XML) and navigate to it. Then navigate back to a page in the app. In other words, if you navigate to the webView from Page A, navigate back to Page A (either with goBack() or by specifically navigating to it). Open the Chrome browser on your desktop and in the location bar, type: "chrome://inspect".

Navigate back and forth between Page A and the webView a few times. I see a collection of "detached" webViews until I close the app. Is this going to be a memory issue?

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

    launchForm: function(category, form) {
        var topmost = FrameModule.topmost();

        topmost.navigate({
            create: function() {
                var webView = new WebViewModule.WebView(),
                    page = new PageModule.Page(),
                    actionBar = new ActionBarModule.ActionBar();

                actionBar.title = category;
                webView.canGoBack = false;
                webView.id = "webViewIntf";

                if (app.android) {
                    var actionItem = new ActionBarModule.ActionItem();
                    actionItem.text = "Back";
                    actionItem.android.systemIcon = "res://ic_menu_back";
                    actionItem.android.position = "actionBarIfRoom";
                    actionItem.on("tap", function() {
                        if (page.frame.canGoBack()) {
                            FrameModule.goBack();
                        } else {
                            var topmost = FrameModule.topmost();
                            topmost.navigate("main-page");
                        }
                    });

                    actionBar.actionItems.addItem(actionItem);
                } else {
                    var navButton = new ActionBarModule.NavigationButton();
                    navButton.text = "Go Back";
                    actionBar.navigationButton = navButton;
                }

                page.actionBar = actionBar;
                page.content = webView;
                webView.src = "http://www.google.com";

                page.on('loaded', function(args) {
                    var webView = page.getViewById("webViewIntf");
                    var webViewInterface = new webViewInterfaceModule.WebViewInterface(webView);

                    if(webView.android) { // in IOS android will be undefined
                        webView.android.getSettings().setBuiltInZoomControls(false);
                    }
                });

                return page;
            },
            animated: false,
            backstackVisible: false
        });
    },
@tsonevn tsonevn self-assigned this May 3, 2016
@hamorphis
Copy link
Contributor

I will investigate this issue. Most probably we have to clean something native (i.e. Android's) when the NativeScript WebView wrapper gets unloaded.

@hamorphis hamorphis assigned hamorphis and unassigned tsonevn May 3, 2016
@hamorphis hamorphis changed the title Memory issue? WebView still visible in chrome://inspect WebView still visible in chrome://inspect after page is destroyed May 3, 2016
@hamorphis hamorphis added done and removed in progress labels May 3, 2016
@hamorphis hamorphis added this to the 2.1 milestone Jun 14, 2016
@lock
Copy link

lock bot commented Aug 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants