Skip to content

Commit 947dd93

Browse files
committed
[HGNN-7715] use whitelist constolled by web instead of AllowedSchemes in android(native)
1 parent ae99b8e commit 947dd93

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

src/android/InAppBrowser.java

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,29 +1443,16 @@ else if (url.startsWith(INTENT_PROTOCOL_START)) {
14431443
}
14441444
// Test for whitelisted custom scheme names like mycoolapp:// or twitteroauthresponse:// (Twitter Oauth Response)
14451445
else if (!url.startsWith("http:") && !url.startsWith("https:") && url.matches("^[A-Za-z0-9+.-]*://.*?$")) {
1446-
if (allowedSchemes == null) {
1447-
String allowed = preferences.getString("AllowedSchemes", null);
1448-
if(allowed != null) {
1449-
allowedSchemes = allowed.split(",");
1450-
}
1451-
}
1452-
if (allowedSchemes != null) {
1453-
for (String scheme : allowedSchemes) {
1454-
if (url.startsWith(scheme)) {
1455-
try {
1456-
JSONObject obj = new JSONObject();
1457-
obj.put("type", "customscheme");
1458-
obj.put("url", url);
1459-
sendUpdate(obj, true);
1460-
override = true;
1461-
} catch (JSONException ex) {
1462-
LOG.e(LOG_TAG, "Custom Scheme URI passed in has caused a JSON error.");
1463-
}
1464-
}
1465-
}
1446+
try {
1447+
JSONObject obj = new JSONObject();
1448+
obj.put("type", "customscheme");
1449+
obj.put("url", url);
1450+
sendUpdate(obj, true);
1451+
override = true;
1452+
} catch (JSONException ex) {
1453+
LOG.e(LOG_TAG, "Custom Scheme URI passed in has caused a JSON error.");
14661454
}
14671455
}
1468-
14691456
if (useBeforeload) {
14701457
this.waitForBeforeload = true;
14711458
}

0 commit comments

Comments
 (0)