mirror of
https://github.com/apache/cordova-android.git
synced 2026-02-21 00:02:46 +08:00
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-android into 2.6.x
This commit is contained in:
@@ -151,6 +151,21 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
pluginResult.setKeepCallback(false);
|
||||
this.callbackContext.sendPluginResult(pluginResult);
|
||||
}
|
||||
else if (action.equals("injectScriptCode")) {
|
||||
String source = args.getString(0);
|
||||
|
||||
org.json.JSONArray jsonEsc = new org.json.JSONArray();
|
||||
jsonEsc.put(source);
|
||||
String jsonRepr = jsonEsc.toString();
|
||||
String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1);
|
||||
String scriptEnclosure = "(function(d){var c=d.createElement('script');c.type='text/javascript';c.innerText="
|
||||
+ jsonSourceString
|
||||
+ ";d.getElementsByTagName('head')[0].appendChild(c);})(document)";
|
||||
this.inAppWebView.loadUrl("javascript:" + scriptEnclosure);
|
||||
|
||||
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
|
||||
this.callbackContext.sendPluginResult(pluginResult);
|
||||
}
|
||||
else {
|
||||
status = PluginResult.Status.INVALID_ACTION;
|
||||
}
|
||||
@@ -445,7 +460,7 @@ public class InAppBrowser extends CordovaPlugin {
|
||||
|
||||
//Toggle whether this is enabled or not!
|
||||
Bundle appSettings = cordova.getActivity().getIntent().getExtras();
|
||||
boolean enableDatabase = appSettings.getBoolean("InAppBrowserStorageEnabled", true);
|
||||
boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true);
|
||||
if(enableDatabase)
|
||||
{
|
||||
String databasePath = cordova.getActivity().getApplicationContext().getDir("inAppBrowserDB", Context.MODE_PRIVATE).getPath();
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||
import android.content.Intent;
|
||||
import android.content.res.XmlResourceParser;
|
||||
|
||||
import android.util.Log;
|
||||
import android.webkit.WebResourceResponse;
|
||||
|
||||
/**
|
||||
@@ -213,6 +214,7 @@ public class PluginManager {
|
||||
public boolean exec(String service, String action, String callbackId, String rawArgs) {
|
||||
CordovaPlugin plugin = this.getPlugin(service);
|
||||
if (plugin == null) {
|
||||
Log.d(TAG, "exec() call to unknown plugin: " + service);
|
||||
PluginResult cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
|
||||
app.sendPluginResult(cr, callbackId);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user