зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1106347 - Don't die when retrieving over-large favicons from the database. r=mfinkle
This commit is contained in:
Родитель
bcfa00a2e3
Коммит
8f7c48fbe2
|
@ -1001,6 +1001,7 @@ public class LocalBrowserDB {
|
|||
new String[] { faviconURL },
|
||||
null);
|
||||
|
||||
boolean shouldDelete = false;
|
||||
byte[] b = null;
|
||||
try {
|
||||
if (!c.moveToFirst()) {
|
||||
|
@ -1008,11 +1009,28 @@ public class LocalBrowserDB {
|
|||
}
|
||||
|
||||
final int faviconIndex = c.getColumnIndexOrThrow(Favicons.DATA);
|
||||
try {
|
||||
b = c.getBlob(faviconIndex);
|
||||
} catch (IllegalStateException e) {
|
||||
// This happens when the blob is more than 1MB: Bug 1106347.
|
||||
// Delete that row.
|
||||
shouldDelete = true;
|
||||
}
|
||||
} finally {
|
||||
c.close();
|
||||
}
|
||||
|
||||
if (shouldDelete) {
|
||||
try {
|
||||
Log.d(LOGTAG, "Deleting invalid favicon.");
|
||||
cr.delete(mFaviconsUriWithProfile,
|
||||
Favicons.URL + " = ?",
|
||||
new String[] { faviconURL });
|
||||
} catch (Exception e) {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
if (b == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче