From 2e9cbdcb0d38a358d8b636691795a7ff1ae60429 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 8 Apr 2015 21:01:50 -0400 Subject: [PATCH] Remove unused CordovaWebViewImpl parameter, and make pluginManager private It was public by accident - with the final design leaving it public does not help with backwards-compatibility. --- framework/src/org/apache/cordova/CordovaActivity.java | 2 +- .../src/org/apache/cordova/CordovaWebViewImpl.java | 11 +++++------ .../cordova/test/CordovaWebViewTestActivity.java | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index e1f917cd..43a68e6a 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -185,7 +185,7 @@ public class CordovaActivity extends Activity { * Override this to customize the webview that is used. */ protected CordovaWebView makeWebView() { - return new CordovaWebViewImpl(this, makeWebViewEngine()); + return new CordovaWebViewImpl(makeWebViewEngine()); } protected CordovaWebViewEngine makeWebViewEngine() { diff --git a/framework/src/org/apache/cordova/CordovaWebViewImpl.java b/framework/src/org/apache/cordova/CordovaWebViewImpl.java index 868ad4f9..a336e123 100644 --- a/framework/src/org/apache/cordova/CordovaWebViewImpl.java +++ b/framework/src/org/apache/cordova/CordovaWebViewImpl.java @@ -48,8 +48,7 @@ public class CordovaWebViewImpl implements CordovaWebView { public static final String TAG = "CordovaWebViewImpl"; - // Public for backwards-compatibility :( - public PluginManager pluginManager; + private PluginManager pluginManager; protected final CordovaWebViewEngine engine; private CordovaInterface cordova; @@ -84,10 +83,10 @@ public class CordovaWebViewImpl implements CordovaWebView { } } - public CordovaWebViewImpl(Context context, CordovaWebViewEngine cordovaWebViewEngine) { - this.context = context; + public CordovaWebViewImpl(CordovaWebViewEngine cordovaWebViewEngine) { this.engine = cordovaWebViewEngine; } + // Convenience method for when creating programmatically (not from Config.xml). public void init(CordovaInterface cordova) { init(cordova, new ArrayList(), new CordovaPreferences()); @@ -461,7 +460,6 @@ public class CordovaWebViewImpl implements CordovaWebView { } pluginManager.onStop(); } - @Override public void handleDestroy() { if (!isInitialized()) { @@ -473,7 +471,8 @@ public class CordovaWebViewImpl implements CordovaWebView { // Forward to plugins this.pluginManager.onDestroy(); - // Load blank page so that JavaScript onunload is called + // TODO: about:blank is a bit special (and the default URL for new frames) + // We should use a blank data: url instead so it's more obvious this.loadUrl("about:blank"); // TODO: Should not destroy webview until after about:blank is done loading. diff --git a/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java b/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java index f52379d3..e79e1069 100644 --- a/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java +++ b/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java @@ -62,7 +62,7 @@ public class CordovaWebViewTestActivity extends Activity { parser.parse(this); SystemWebView webView = (SystemWebView) findViewById(R.id.cordovaWebView); - cordovaWebView = new CordovaWebViewImpl(this, new SystemWebViewEngine(webView)); + cordovaWebView = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); cordovaWebView.init(cordovaInterface, parser.getPluginEntries(), parser.getPreferences()); cordovaWebView.loadUrl(START_URL);