-
Notifications
You must be signed in to change notification settings - Fork 984
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
Platform centered approach: let's add a way to destroy a WKWebView when done #1486
Comments
I think the fix would be to null out the webview in the plugin's |
…fully will revert (apache#1486)
… this property is cleared (apache#1486)
This indeed did the trick. Adding ‘_engineWebView = nil;’ right before the [super dispose]; call is the only change needed. It will take some time for me to get permission to raise this PR. |
Feature Request
Even though there is an attempt to "clear out" the WKWebView in the
CDVViewController.m
dealloc method, the WKWebView inCDVWebViewEngine.m
is not simultaneously made nil, so it hangs around. I'd like to update these two classes to fully nil out WKWebView.Motivation Behind Feature
In an otherwise native app that includes Cordova as a Swift Package to occasionally open Cordova Web Views for specific features (e.g., the Platform Centered Approach) it is common to open and close CDVViewControllers in the course of a user session, as a user navigates around. Because there is no exposed method to fully destroy a WKWebView, all of the web views opened hang around, increasing system memory footprint (albeit outside of the host app's process).
Feature Description
I will likely just call a new method in dealloc, or I could leave it up to a platform centered approach consumer to make the call--I want to think about it a bit. This shouldn't have any impact on the non-platform centered approach, and we use that as well, so it should be easy to test both.
Alternatives or Workarounds
It's possible to mimic some of what's done in dealloc, and "lighten" the WKWebView by loading an empty string and removing script message handlers, but it would be better to just kill it when done.
The text was updated successfully, but these errors were encountered: