Merge change 26909 into eclair

* changes:
  Not all WebView's host have permission to read the history. Add a security catch and return an empty list.
This commit is contained in:
Android (Google) Code Review
2009-09-24 17:24:40 -04:00
2 changed files with 20 additions and 18 deletions

View File

@@ -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];
}
}
/**

View File

@@ -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];
}
/**