Don't allow the user to save bookmarks with a scheme that the Browser cannot directly handle.
Change-Id: I9cbdfeaaeef4ded3dac1623854ecb9c5c603eb91
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index 81123ba..9ab8473 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -182,9 +182,14 @@
try {
URI uriObj = new URI(url);
String scheme = uriObj.getScheme();
- if (!("about".equals(scheme) || "data".equals(scheme)
- || "javascript".equals(scheme)
- || "file".equals(scheme) || "content".equals(scheme))) {
+ if (!Bookmarks.urlHasAcceptableScheme(url)) {
+ // If the scheme was non-null, let the user know that we
+ // can't save their bookmark. If it was null, we'll assume
+ // they meant http when we parse it in the WebAddress class.
+ if (scheme != null) {
+ mAddress.setError(r.getText(R.string.bookmark_cannot_save_url));
+ return false;
+ }
WebAddress address;
try {
address = new WebAddress(unfilteredUrl);