Bug 1893635 - Handle disconnection from global in IDBFactory::Databases; r=dom-storage-reviewers,webidl,saschanaz,asuth

Differential Revision: https://phabricator.services.mozilla.com/D209206
This commit is contained in:
Jan Varga 2024-05-03 07:21:06 +00:00
Родитель d8e149681f
Коммит 11443624aa
3 изменённых файлов: 9 добавлений и 2 удалений

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

@ -400,7 +400,13 @@ RefPtr<IDBOpenDBRequest> IDBFactory::DeleteDatabase(JSContext* aCx,
/* aDeleting */ true, aCallerType, aRv);
}
already_AddRefed<Promise> IDBFactory::Databases(JSContext* const aCx) {
already_AddRefed<Promise> IDBFactory::Databases(JSContext* const aCx,
ErrorResult& aRv) {
if (NS_WARN_IF(!GetOwnerGlobal())) {
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return nullptr;
}
RefPtr<Promise> promise = Promise::CreateInfallible(GetOwnerGlobal());
// Nothing can be done here if we have previously failed to create a

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

@ -156,7 +156,7 @@ class IDBFactory final : public GlobalTeardownObserver, public nsWrapperCache {
CallerType aCallerType,
ErrorResult& aRv);
already_AddRefed<Promise> Databases(JSContext* aCx);
already_AddRefed<Promise> Databases(JSContext* aCx, ErrorResult& aRv);
int16_t Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst,
JS::Handle<JS::Value> aSecond, ErrorResult& aRv);

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

@ -33,6 +33,7 @@ interface IDBFactory {
IDBOpenDBRequest
deleteDatabase(DOMString name);
[Throws]
Promise<sequence<IDBDatabaseInfo>> databases();
[Throws]