diff --git a/package.json b/package.json index 2838435a6..4b27e701b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-inappbrowser", - "version": "5.0.0", + "version": "5.0.1-dev", "description": "Cordova InAppBrowser Plugin", "types": "./types/index.d.ts", "cordova": { diff --git a/plugin.xml b/plugin.xml index 6e06ac505..d061c700e 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,7 +20,7 @@ + version="5.0.1-dev"> InAppBrowser Cordova InAppBrowser Plugin diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 479e04cd7..6e44803a7 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -534,6 +534,16 @@ public void onPageFinished(WebView view, String url) { dialog.dismiss(); dialog = null; } + + // Fix for webView window not being destroyed correctly causing memory leak + // (https://github.com/apache/cordova-plugin-inappbrowser/issues/290) + if (url.equals(new String("about:blank"))) { + inAppWebView.onPause(); + inAppWebView.removeAllViews(); + inAppWebView.destroyDrawingCache(); + inAppWebView.destroy(); + inAppWebView = null; + } } }); // NB: From SDK 19: "If you call methods on WebView from any thread diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index cf4b6f612..2adcf0c1b 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -539,8 +539,9 @@ - (void)webView:(WKWebView *)theWebView decidePolicyForNavigationAction:(WKNavig [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId]; } - //if is an app store link, let the system handle it, otherwise it fails to load it - if ([[ url scheme] isEqualToString:@"itms-appss"] || [[ url scheme] isEqualToString:@"itms-apps"]) { + //if is an app store, tel, sms, mailto or geo link, let the system handle it, otherwise it fails to load it + NSArray * allowedSchemes = @[@"itms-appss", @"itms-apps", @"tel", @"sms", @"mailto", @"geo"]; + if ([allowedSchemes containsObject:[url scheme]]) { [theWebView stopLoading]; [self openInSystem:url]; shouldStart = NO; diff --git a/tests/package.json b/tests/package.json index 729e6c0ae..dd735b5c8 100644 --- a/tests/package.json +++ b/tests/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-inappbrowser-tests", - "version": "5.0.0", + "version": "5.0.1-dev", "description": "", "cordova": { "id": "cordova-plugin-inappbrowser-tests", diff --git a/tests/plugin.xml b/tests/plugin.xml index e250ad765..08eb791b6 100644 --- a/tests/plugin.xml +++ b/tests/plugin.xml @@ -20,7 +20,7 @@ + version="5.0.1-dev"> Cordova InAppBrowser Plugin Tests Apache 2.0