FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

WebView still visible in chrome://inspect after page is destroyed · Issue #2053 · NativeScript/NativeScript · GitHub

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

Description

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
        });
    },

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL