From db674fb4e85c5ae63c05368b0b13e64be6ad118d Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Thu, 24 Sep 2009 14:14:11 -0700 Subject: [PATCH] Not all WebView's host have permission to read the history. Add a security catch and return an empty list. We don't use tab in the code. Fix http://b/viewIssue?id=2144339 --- core/java/android/provider/Browser.java | 34 +++++++++++------------ core/java/android/webkit/WebViewCore.java | 4 ++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java index 4600b49c3b82c..c8b7f99d64c5d 100644 --- a/core/java/android/provider/Browser.java +++ b/core/java/android/provider/Browser.java @@ -280,23 +280,23 @@ public class Browser { * @hide pending API council approval */ public static final String[] getVisitedHistory(ContentResolver cr) { - try { - String[] projection = new String[] { "url" }; - Cursor c = cr.query(BOOKMARKS_URI, - projection, - "visits > 0", - null, null); - String[] str = new String[c.getCount()]; - int i = 0; - while (c.moveToNext()) { - str[i] = c.getString(0); - i++; - } - c.deactivate(); - return str; - } catch (IllegalStateException e) { - return new String[0]; - } + try { + String[] projection = new String[] { + "url" + }; + Cursor c = cr.query(BOOKMARKS_URI, projection, "visits > 0", null, + null); + String[] str = new String[c.getCount()]; + int i = 0; + while (c.moveToNext()) { + str[i] = c.getString(0); + i++; + } + c.deactivate(); + return str; + } catch (IllegalStateException e) { + return new String[0]; + } } /** diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index f617401f5e3e0..8b9ca57d7ef4a 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -312,7 +312,9 @@ final class WebViewCore { } protected String[] populateVisitedLinks() { - return Browser.getVisitedHistory(mContext.getContentResolver()); + // FIXME: getVisitedHistory needs permission and host may not have. +// return Browser.getVisitedHistory(mContext.getContentResolver()); + return new String[0]; } /**