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
This commit is contained in:
Grace Kloba
2009-09-24 14:14:11 -07:00
committed by android-build SharedAccount
parent 8c2623e997
commit bf54f02b59
2 changed files with 20 additions and 18 deletions

View File

@@ -280,23 +280,23 @@ public class Browser {
* @hide pending API council approval * @hide pending API council approval
*/ */
public static final String[] getVisitedHistory(ContentResolver cr) { public static final String[] getVisitedHistory(ContentResolver cr) {
try { try {
String[] projection = new String[] { "url" }; String[] projection = new String[] {
Cursor c = cr.query(BOOKMARKS_URI, "url"
projection, };
"visits > 0", Cursor c = cr.query(BOOKMARKS_URI, projection, "visits > 0", null,
null, null); null);
String[] str = new String[c.getCount()]; String[] str = new String[c.getCount()];
int i = 0; int i = 0;
while (c.moveToNext()) { while (c.moveToNext()) {
str[i] = c.getString(0); str[i] = c.getString(0);
i++; i++;
} }
c.deactivate(); c.deactivate();
return str; return str;
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
return new String[0]; return new String[0];
} }
} }
/** /**

View File

@@ -312,7 +312,9 @@ final class WebViewCore {
} }
protected String[] populateVisitedLinks() { 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];
} }
/** /**