summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-06-17 22:46:02 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-17 22:46:02 -0700
commit7874657df1a62c8e3b2b9fcc47570333664d6988 (patch)
tree6f960c23573316f0f29957d28514da867e73abb9 /src/com/android/browser
parent74c5a874a148c4d80354b6c88a8151374aa25b62 (diff)
parent9918943559193e3e047a1c18442e2cdb0fe22b15 (diff)
downloadpackages_apps_browser-7874657df1a62c8e3b2b9fcc47570333664d6988.zip
packages_apps_browser-7874657df1a62c8e3b2b9fcc47570333664d6988.tar.gz
packages_apps_browser-7874657df1a62c8e3b2b9fcc47570333664d6988.tar.bz2
am 99189435: Update browser to use new Intent URI expansion.
Merge commit '9918943559193e3e047a1c18442e2cdb0fe22b15' * commit '9918943559193e3e047a1c18442e2cdb0fe22b15': Update browser to use new Intent URI expansion.
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/BrowserActivity.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 7d2ec61..363c6d7 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -137,6 +137,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
import java.text.ParseException;
@@ -3117,16 +3118,26 @@ public class BrowserActivity extends Activity
}
}
- Uri uri;
+ // The "about:" schemes are internal to the browser; don't
+ // want these to be dispatched to other apps.
+ if (url.startsWith("about:")) {
+ return false;
+ }
+
+ Intent intent;
+
+ // perform generic parsing of the URI to turn it into an Intent.
try {
- uri = Uri.parse(url);
- } catch (IllegalArgumentException ex) {
+ intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
+ } catch (URISyntaxException ex) {
+ Log.w("Browser", "Bad URI " + url + ": " + ex.getMessage());
return false;
}
- // check whether other activities want to handle this url
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ // sanitize the Intent, ensuring web pages can not bypass browser
+ // security (only access to BROWSABLE activities).
intent.addCategory(Intent.CATEGORY_BROWSABLE);
+ intent.setComponent(null);
try {
if (startActivityIfNeeded(intent, -1)) {
return true;