mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1211591 - Part 1: Remove incorrect sql statement from nsPermissionManager::RemovePermissionsForApp, r=jdm
This initial query to clear the database was initially removed because of the removal of the appId column, and replaced with the following logic which parses the origin strings to obtain the appId property, and then removes those entries using `AddInternal`. Unfortunately, during a rebase, it appears as though the code crept back into the codebase. I'm not sure why this codepath wasn't ever tested before bkelly noticed it, but we should probably add a test of some form which actually runs the RemovePermissionsForApp codepath, to ensure that it actually works.
This commit is contained in:
parent
6e670e3735
commit
ba2b61bb75
@ -2315,30 +2315,6 @@ nsPermissionManager::RemovePermissionsForApp(uint32_t aAppId, bool aBrowserOnly)
|
||||
ENSURE_NOT_CHILD_PROCESS;
|
||||
NS_ENSURE_ARG(aAppId != nsIScriptSecurityManager::NO_APP_ID);
|
||||
|
||||
// We begin by removing all the permissions from the DB.
|
||||
// After clearing the DB, we call AddInternal() to make sure that all
|
||||
// processes are aware of this change and the representation of the DB in
|
||||
// memory is updated.
|
||||
// We have to get all permissions associated with an application first
|
||||
// because removing entries from the permissions table while iterating over
|
||||
// it is dangerous.
|
||||
|
||||
nsAutoCString sql;
|
||||
sql.AppendLiteral("DELETE FROM moz_perms WHERE appId=");
|
||||
sql.AppendInt(aAppId);
|
||||
|
||||
if (aBrowserOnly) {
|
||||
sql.AppendLiteral(" AND isInBrowserElement=1");
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIStorageAsyncStatement> removeStmt;
|
||||
nsresult rv = mDBConn->CreateAsyncStatement(sql, getter_AddRefs(removeStmt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<mozIStoragePendingStatement> pending;
|
||||
rv = removeStmt->ExecuteAsync(nullptr, getter_AddRefs(pending));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMArray<nsIPermission> permissions;
|
||||
for (auto iter = mPermissionTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
PermissionHashKey* entry = iter.Get();
|
||||
|
Loading…
Reference in New Issue
Block a user