From c455cf46f114549cefb98ceea0f483e1d38ae62c Mon Sep 17 00:00:00 2001 From: Paul Zuehlcke Date: Tue, 28 May 2024 15:26:04 +0000 Subject: [PATCH] Bug 1899292 - Call EnsureReadCompleted before computing permission type index. r=permissions-reviewers,timhuang Differential Revision: https://phabricator.services.mozilla.com/D211854 --- extensions/permissions/PermissionManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extensions/permissions/PermissionManager.cpp b/extensions/permissions/PermissionManager.cpp index 39373653a6b1..877269ce19b8 100644 --- a/extensions/permissions/PermissionManager.cpp +++ b/extensions/permissions/PermissionManager.cpp @@ -2195,6 +2195,10 @@ NS_IMETHODIMP PermissionManager::RemoveByType(const nsACString& aType) { ENSURE_NOT_CHILD_PROCESS; + // Need to make sure read is done before we get the type index. Type indexes + // are populated from DB. + EnsureReadCompleted(); + int32_t typeIndex = GetTypeIndex(aType, false); // If type == -1, the type isn't known, // so just return NS_OK @@ -2213,6 +2217,10 @@ PermissionManager::RemoveByTypeSince(const nsACString& aType, int64_t aModificationTime) { ENSURE_NOT_CHILD_PROCESS; + // Need to make sure read is done before we get the type index. Type indexes + // are populated from DB. + EnsureReadCompleted(); + int32_t typeIndex = GetTypeIndex(aType, false); // If type == -1, the type isn't known, // so just return NS_OK