mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 814554 - Don't stop reading the permissions database when an invalid entry is found. r=sicking
This commit is contained in:
parent
ec2556d7c9
commit
ee12f3c912
@ -1316,6 +1316,8 @@ nsPermissionManager::Read()
|
||||
uint32_t appId;
|
||||
bool isInBrowserElement;
|
||||
bool hasResult;
|
||||
bool readError = false;
|
||||
|
||||
while (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
|
||||
// explicitly set our entry id counter for use in AddInternal(),
|
||||
// and keep track of the largest id so we know where to pick up.
|
||||
@ -1324,10 +1326,16 @@ nsPermissionManager::Read()
|
||||
mLargestID = id;
|
||||
|
||||
rv = stmt->GetUTF8String(1, host);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
readError = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
rv = stmt->GetUTF8String(2, type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
readError = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
permission = stmt->AsInt32(3);
|
||||
expireType = stmt->AsInt32(4);
|
||||
@ -1341,11 +1349,22 @@ nsPermissionManager::Read()
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsresult rv = GetPrincipal(host, appId, isInBrowserElement, getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
readError = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
rv = AddInternal(principal, type, permission, id, expireType, expireTime,
|
||||
eDontNotify, eNoDBOperation);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
readError = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (readError) {
|
||||
NS_ERROR("Error occured while reading the permissions database!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user