mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb/IDB: Implement IDBObjectStore::indexNames
This commit is contained in:
parent
a5b1a51164
commit
fe5bb7d77d
3 changed files with 14 additions and 1 deletions
|
@ -153,4 +153,16 @@ WebIDL::ExceptionOr<GC::Ref<IDBIndex>> IDBObjectStore::create_index(String const
|
||||||
return IDBIndex::create(realm, index, *this);
|
return IDBIndex::create(realm, index, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/IndexedDB/#dom-idbobjectstore-indexnames
|
||||||
|
GC::Ref<HTML::DOMStringList> IDBObjectStore::index_names()
|
||||||
|
{
|
||||||
|
// 1. Let names be a list of the names of the indexes in this's index set.
|
||||||
|
Vector<String> names;
|
||||||
|
for (auto const& [name, index] : m_indexes)
|
||||||
|
names.append(name);
|
||||||
|
|
||||||
|
// 2. Return the result (a DOMStringList) of creating a sorted name list with names.
|
||||||
|
return create_a_sorted_name_list(realm(), names);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
AK::HashMap<String, GC::Ref<Index>>& index_set() { return m_indexes; }
|
AK::HashMap<String, GC::Ref<Index>>& index_set() { return m_indexes; }
|
||||||
|
|
||||||
WebIDL::ExceptionOr<GC::Ref<IDBIndex>> create_index(String const&, KeyPath, IDBIndexParameters options);
|
WebIDL::ExceptionOr<GC::Ref<IDBIndex>> create_index(String const&, KeyPath, IDBIndexParameters options);
|
||||||
|
[[nodiscard]] GC::Ref<HTML::DOMStringList> index_names();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit IDBObjectStore(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
|
explicit IDBObjectStore(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
interface IDBObjectStore {
|
interface IDBObjectStore {
|
||||||
attribute DOMString name;
|
attribute DOMString name;
|
||||||
readonly attribute any keyPath;
|
readonly attribute any keyPath;
|
||||||
[FIXME] readonly attribute DOMStringList indexNames;
|
readonly attribute DOMStringList indexNames;
|
||||||
[SameObject] readonly attribute IDBTransaction transaction;
|
[SameObject] readonly attribute IDBTransaction transaction;
|
||||||
readonly attribute boolean autoIncrement;
|
readonly attribute boolean autoIncrement;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue