Delete url-filters logic (in 4.0.x branch only)

This commit is contained in:
Andrew Grieve 2014-07-08 11:58:56 -04:00
parent 05a95c699f
commit dbb196a17e
3 changed files with 5 additions and 44 deletions

View File

@ -30,7 +30,6 @@ import org.xmlpull.v1.XmlPullParserException;
import android.app.Activity;
import android.content.res.XmlResourceParser;
import android.util.Log;
public class ConfigXmlParser {
private static String TAG = "ConfigXmlParser";
@ -75,18 +74,11 @@ public class ConfigXmlParser {
String service = "", pluginClass = "", paramType = "";
boolean onload = false;
boolean insideFeature = false;
ArrayList<String> urlMap = null;
while (eventType != XmlResourceParser.END_DOCUMENT) {
if (eventType == XmlResourceParser.START_TAG) {
String strNode = xml.getName();
if (strNode.equals("url-filter")) {
Log.w(TAG, "Plugin " + service + " is using deprecated tag <url-filter>");
if (urlMap == null) {
urlMap = new ArrayList<String>(2);
}
urlMap.add(xml.getAttributeValue(null, "value"));
} else if (strNode.equals("feature")) {
if (strNode.equals("feature")) {
//Check for supported feature sets aka. plugins (Accelerometer, Geolocation, etc)
//Set the bit for reading params
insideFeature = true;
@ -124,13 +116,12 @@ public class ConfigXmlParser {
{
String strNode = xml.getName();
if (strNode.equals("feature")) {
pluginEntries.add(new PluginEntry(service, pluginClass, onload, urlMap));
pluginEntries.add(new PluginEntry(service, pluginClass, onload));
service = "";
pluginClass = "";
insideFeature = false;
onload = false;
urlMap = null;
}
}
try {

View File

@ -18,8 +18,6 @@
*/
package org.apache.cordova;
import java.util.List;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
@ -52,14 +50,12 @@ public class PluginEntry {
*/
public boolean onload = false;
private List<String> urlFilters;
/**
* @param service The name of the service
* @param plugin The plugin associated with this entry
*/
public PluginEntry(String service, CordovaPlugin plugin) {
this(service, plugin.getClass().getName(), true, null);
this(service, plugin.getClass().getName(), true);
this.plugin = plugin;
}
@ -69,21 +65,11 @@ public class PluginEntry {
* @param onload Create plugin object when HTML page is loaded
*/
public PluginEntry(String service, String pluginClass, boolean onload) {
this(service, pluginClass, onload, null);
}
public PluginEntry(String service, String pluginClass, boolean onload, List<String> urlFilters) {
this.service = service;
this.pluginClass = pluginClass;
this.onload = onload;
this.urlFilters = urlFilters;
}
public List<String> getUrlFilters() {
return urlFilters;
}
/**
* Create plugin object.
* If plugin is already created, then just return it.

View File

@ -51,10 +51,6 @@ public class PluginManager {
private final CordovaInterface ctx;
private final CordovaWebView app;
// Stores mapping of Plugin Name -> <url-filter> values.
// Using <url-filter> is deprecated.
protected HashMap<String, List<String>> urlMap = new HashMap<String, List<String>>();
private Set<String> pluginIdWhitelist;
PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, List<PluginEntry> pluginEntries) {
@ -68,7 +64,6 @@ public class PluginManager {
this.onDestroy();
this.clearPluginObjects();
entries.clear();
urlMap.clear();
for (PluginEntry entry : pluginEntries) {
addService(entry);
}
@ -211,10 +206,6 @@ public class PluginManager {
*/
public void addService(PluginEntry entry) {
this.entries.put(entry.service, entry);
List<String> urlFilters = entry.getUrlFilters();
if (urlFilters != null) {
urlMap.put(entry.service, urlFilters);
}
}
/**
@ -300,14 +291,7 @@ public class PluginManager {
// that they are loaded before this function is called (either by setting
// the onload <param> or by making an exec() call to them)
for (PluginEntry entry : this.entries.values()) {
List<String> urlFilters = urlMap.get(entry.service);
if (urlFilters != null) {
for (String s : urlFilters) {
if (url.startsWith(s)) {
return getPlugin(entry.service).onOverrideUrlLoading(url);
}
}
} else if (entry.plugin != null) {
if (entry.plugin != null) {
if (entry.plugin.onOverrideUrlLoading(url)) {
return true;
}