@@ -72,7 +72,9 @@ WebIDL::ExceptionOr<void> IDBObjectStore::set_name(String const& value)
7272    //  3. Let store be this’s object store.
7373    auto & store = m_store;
7474
75-     //  FIXME: 4. If store has been deleted, throw an "InvalidStateError" DOMException.
75+     //  4. If store has been deleted, throw an "InvalidStateError" DOMException.
76+     if  (store->is_deleted ())
77+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
7678
7779    //  5. If transaction is not an upgrade transaction, throw an "InvalidStateError" DOMException.
7880    if  (!transaction->is_upgrade_transaction ())
@@ -157,7 +159,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBIndex>> IDBObjectStore::create_index(String const
157159    if  (!transaction->is_upgrade_transaction ())
158160        return  WebIDL::InvalidStateError::create (realm, " Transaction is not an upgrade transaction"  _utf16);
159161
160-     //  FIXME: 4. If store has been deleted, throw an "InvalidStateError" DOMException.
162+     //  4. If store has been deleted, throw an "InvalidStateError" DOMException.
163+     if  (store->is_deleted ())
164+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
161165
162166    //  5. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
163167    if  (!transaction->is_active ())
@@ -195,25 +199,29 @@ WebIDL::ExceptionOr<GC::Ref<IDBIndex>> IDBObjectStore::create_index(String const
195199//  https://w3c.github.io/IndexedDB/#dom-idbobjectstore-index
196200WebIDL::ExceptionOr<GC::Ref<IDBIndex>> IDBObjectStore::index (String const & name)
197201{
202+     auto & realm = this ->realm ();
203+ 
198204    //  1. Let transaction be this’s transaction.
199205    auto  transaction = this ->transaction ();
200206
201207    //  2. Let store be this’s object store.
202-     [[maybe_unused]]  auto  store = this ->store ();
208+     auto  store = this ->store ();
203209
204-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
210+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
211+     if  (store->is_deleted ())
212+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
205213
206214    //  4. If transaction’s state is finished, then throw an "InvalidStateError" DOMException.
207215    if  (transaction->state () == IDBTransaction::TransactionState::Finished)
208-         return  WebIDL::InvalidStateError::create (realm () , " Transaction is finished"  _utf16);
216+         return  WebIDL::InvalidStateError::create (realm, " Transaction is finished"  _utf16);
209217
210218    //  5. Let index be the index named name in this’s index set if one exists, or throw a "NotFoundError" DOMException otherwise.
211219    auto  index = m_indexes.get (name);
212220    if  (!index.has_value ())
213-         return  WebIDL::NotFoundError::create (realm () , " Index not found in object store"  _utf16);
221+         return  WebIDL::NotFoundError::create (realm, " Index not found in object store"  _utf16);
214222
215223    //  6. Return an index handle associated with index and this.
216-     return  IDBIndex::create (realm () , *index, *this );
224+     return  IDBIndex::create (realm, *index, *this );
217225}
218226
219227//  https://w3c.github.io/IndexedDB/#dom-idbobjectstore-deleteindex
@@ -231,7 +239,9 @@ WebIDL::ExceptionOr<void> IDBObjectStore::delete_index(String const& name)
231239    if  (!transaction->is_upgrade_transaction ())
232240        return  WebIDL::InvalidStateError::create (realm, " Transaction is not an upgrade transaction"  _utf16);
233241
234-     //  FIXME: 4. If store has been deleted, throw an "InvalidStateError" DOMException.
242+     //  4. If store has been deleted, throw an "InvalidStateError" DOMException.
243+     if  (store->is_deleted ())
244+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
235245
236246    //  5. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
237247    if  (!transaction->is_active ())
@@ -248,6 +258,8 @@ WebIDL::ExceptionOr<void> IDBObjectStore::delete_index(String const& name)
248258    //  8. Destroy index.
249259    store->index_set ().remove (name);
250260
261+     index.release_value ()->mark_deleted ();
262+ 
251263    return  {};
252264}
253265
@@ -262,7 +274,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::add_or_put(GC::Ref<IDBO
262274    //  2. Let store be handle’s object store.
263275    auto & store = *handle->store ();
264276
265-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
277+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
278+     if  (store.is_deleted ())
279+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
266280
267281    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
268282    if  (!transaction->is_active ())
@@ -370,7 +384,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::count(Optional<JS::Valu
370384    //  2. Let store be this's object store.
371385    auto  store = this ->store ();
372386
373-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
387+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
388+     if  (store->is_deleted ())
389+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
374390
375391    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
376392    if  (!transaction->is_active ())
@@ -401,7 +417,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::get(JS::Value query)
401417    //  2. Let store be this's object store.
402418    auto  store = this ->store ();
403419
404-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
420+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
421+     if  (store->is_deleted ())
422+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
405423
406424    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
407425    if  (!transaction->is_active ())
@@ -430,9 +448,11 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::open_cursor(JS::Value q
430448    auto  transaction = this ->transaction ();
431449
432450    //  2. Let store be this's object store.
433-     [[maybe_unused]]  auto  store = this ->store ();
451+     auto  store = this ->store ();
434452
435-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
453+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
454+     if  (store->is_deleted ())
455+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
436456
437457    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
438458    if  (!transaction->is_active ())
@@ -472,7 +492,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::delete_(JS::Value query
472492    //  2. Let store be this’s object store.
473493    auto  store = this ->store ();
474494
475-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
495+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
496+     if  (store->is_deleted ())
497+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
476498
477499    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
478500    if  (!transaction->is_active ())
@@ -507,7 +529,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::clear()
507529    //  2. Let store be this’s object store.
508530    auto  store = this ->store ();
509531
510-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
532+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
533+     if  (store->is_deleted ())
534+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
511535
512536    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
513537    if  (!transaction->is_active ())
@@ -539,7 +563,9 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::get_key(JS::Value query
539563    //  2. Let store be this’s object store.
540564    auto  store = this ->store ();
541565
542-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
566+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
567+     if  (store->is_deleted ())
568+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
543569
544570    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
545571    if  (!transaction->is_active ())
@@ -576,9 +602,11 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::open_key_cursor(JS::Val
576602    auto  transaction = this ->transaction ();
577603
578604    //  2. Let store be this’s object store.
579-     [[maybe_unused]]  auto  store = this ->store ();
605+     auto  store = this ->store ();
580606
581-     //  FIXME: 3. If store has been deleted, throw an "InvalidStateError" DOMException.
607+     //  3. If store has been deleted, throw an "InvalidStateError" DOMException.
608+     if  (store->is_deleted ())
609+         return  WebIDL::InvalidStateError::create (realm, " Object store has been deleted"  _utf16);
582610
583611    //  4. If transaction’s state is not active, then throw a "TransactionInactiveError" DOMException.
584612    if  (!transaction->is_active ())
0 commit comments