mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Remove whitelist config.xml parsing
This commit is contained in:
parent
83377d366a
commit
ed78b557cd
@ -36,18 +36,8 @@ public class ConfigXmlParser {
|
|||||||
|
|
||||||
private String launchUrl = "file:///android_asset/www/index.html";
|
private String launchUrl = "file:///android_asset/www/index.html";
|
||||||
private CordovaPreferences prefs = new CordovaPreferences();
|
private CordovaPreferences prefs = new CordovaPreferences();
|
||||||
private Whitelist internalWhitelist = new Whitelist();
|
|
||||||
private Whitelist externalWhitelist = new Whitelist();
|
|
||||||
private ArrayList<PluginEntry> pluginEntries = new ArrayList<PluginEntry>(20);
|
private ArrayList<PluginEntry> pluginEntries = new ArrayList<PluginEntry>(20);
|
||||||
|
|
||||||
public Whitelist getInternalWhitelist() {
|
|
||||||
return internalWhitelist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Whitelist getExternalWhitelist() {
|
|
||||||
return externalWhitelist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CordovaPreferences getPreferences() {
|
public CordovaPreferences getPreferences() {
|
||||||
return prefs;
|
return prefs;
|
||||||
}
|
}
|
||||||
@ -81,11 +71,6 @@ public class ConfigXmlParser {
|
|||||||
public void parse(XmlResourceParser xml) {
|
public void parse(XmlResourceParser xml) {
|
||||||
int eventType = -1;
|
int eventType = -1;
|
||||||
|
|
||||||
// Add implicitly allowed URLs
|
|
||||||
internalWhitelist.addWhiteListEntry("file:///*", false);
|
|
||||||
internalWhitelist.addWhiteListEntry("content:///*", false);
|
|
||||||
internalWhitelist.addWhiteListEntry("data:*", false);
|
|
||||||
|
|
||||||
while (eventType != XmlResourceParser.END_DOCUMENT) {
|
while (eventType != XmlResourceParser.END_DOCUMENT) {
|
||||||
if (eventType == XmlResourceParser.START_TAG) {
|
if (eventType == XmlResourceParser.START_TAG) {
|
||||||
handleStartTag(xml);
|
handleStartTag(xml);
|
||||||
@ -121,26 +106,6 @@ public class ConfigXmlParser {
|
|||||||
else if (paramType.equals("onload"))
|
else if (paramType.equals("onload"))
|
||||||
onload = "true".equals(xml.getAttributeValue(null, "value"));
|
onload = "true".equals(xml.getAttributeValue(null, "value"));
|
||||||
}
|
}
|
||||||
else if (strNode.equals("access")) {
|
|
||||||
String origin = xml.getAttributeValue(null, "origin");
|
|
||||||
String subdomains = xml.getAttributeValue(null, "subdomains");
|
|
||||||
boolean external = (xml.getAttributeValue(null, "launch-external") != null);
|
|
||||||
if (origin != null) {
|
|
||||||
if (external) {
|
|
||||||
externalWhitelist.addWhiteListEntry(origin, (subdomains != null) && (subdomains.compareToIgnoreCase("true") == 0));
|
|
||||||
} else {
|
|
||||||
if ("*".equals(origin)) {
|
|
||||||
// Special-case * origin to mean http and https when used for internal
|
|
||||||
// whitelist. This prevents external urls like sms: and geo: from being
|
|
||||||
// handled internally.
|
|
||||||
internalWhitelist.addWhiteListEntry("http://*/*", false);
|
|
||||||
internalWhitelist.addWhiteListEntry("https://*/*", false);
|
|
||||||
} else {
|
|
||||||
internalWhitelist.addWhiteListEntry(origin, (subdomains != null) && (subdomains.compareToIgnoreCase("true") == 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (strNode.equals("preference")) {
|
else if (strNode.equals("preference")) {
|
||||||
String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.ENGLISH);
|
String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.ENGLISH);
|
||||||
String value = xml.getAttributeValue(null, "value");
|
String value = xml.getAttributeValue(null, "value");
|
||||||
|
Loading…
Reference in New Issue
Block a user