Bug 1847768 - Storage access API sometimes rejects instead of autogranting - r=timhuang

Differential Revision: https://phabricator.services.mozilla.com/D185686
This commit is contained in:
Benjamin VanderSloot 2023-08-09 19:35:36 +00:00
Родитель 693499c1ea
Коммит f29b435076
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -17318,10 +17318,12 @@ Document::CreatePermissionGrantPromise(
if (!autoGrant) {
p->Resolve(choice, __func__);
} else {
// We capture sapr here to prevent it from destructing
// before the callbacks complete.
sapr->MaybeDelayAutomaticGrants()->Then(
GetCurrentSerialEventTarget(), __func__,
[p, choice] { p->Resolve(choice, __func__); },
[p] { p->Reject(false, __func__); });
[p, sapr, choice] { p->Resolve(choice, __func__); },
[p, sapr] { p->Reject(false, __func__); });
}
return;
}