mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
LibWeb/IDB: Implement IDBObjectStore::autoIncrement
This commit is contained in:
parent
b0453e044d
commit
2e02b62126
Notes:
github-actions[bot]
2025-03-27 15:49:18 +00:00
Author: https://github.com/stelar7
Commit: 2e02b62126
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4077
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/gmta ✅
3 changed files with 6 additions and 4 deletions
|
@ -26,6 +26,10 @@ public:
|
||||||
JS::Value key_path() const;
|
JS::Value key_path() const;
|
||||||
GC::Ref<IDBTransaction> transaction() const { return m_transaction; }
|
GC::Ref<IDBTransaction> transaction() const { return m_transaction; }
|
||||||
|
|
||||||
|
// https://w3c.github.io/IndexedDB/#dom-idbobjectstore-autoincrement
|
||||||
|
// The autoIncrement getter steps are to return true if this’s object store has a key generator, and false otherwise.
|
||||||
|
bool auto_increment() const { return m_store->key_generator().has_value(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit IDBObjectStore(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
|
explicit IDBObjectStore(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
|
@ -8,7 +8,7 @@ interface IDBObjectStore {
|
||||||
readonly attribute any keyPath;
|
readonly attribute any keyPath;
|
||||||
[FIXME] readonly attribute DOMStringList indexNames;
|
[FIXME] readonly attribute DOMStringList indexNames;
|
||||||
[SameObject] readonly attribute IDBTransaction transaction;
|
[SameObject] readonly attribute IDBTransaction transaction;
|
||||||
[FIXME] readonly attribute boolean autoIncrement;
|
readonly attribute boolean autoIncrement;
|
||||||
|
|
||||||
[FIXME, NewObject] IDBRequest put(any value, optional any key);
|
[FIXME, NewObject] IDBRequest put(any value, optional any key);
|
||||||
[FIXME, NewObject] IDBRequest add(any value, optional any key);
|
[FIXME, NewObject] IDBRequest add(any value, optional any key);
|
||||||
|
|
|
@ -33,9 +33,7 @@ public:
|
||||||
Optional<KeyPath> key_path() const { return m_key_path; }
|
Optional<KeyPath> key_path() const { return m_key_path; }
|
||||||
bool uses_inline_keys() const { return m_key_path.has_value(); }
|
bool uses_inline_keys() const { return m_key_path.has_value(); }
|
||||||
bool uses_out_of_line_keys() const { return !m_key_path.has_value(); }
|
bool uses_out_of_line_keys() const { return !m_key_path.has_value(); }
|
||||||
|
Optional<KeyGenerator> key_generator() const { return m_key_generator; }
|
||||||
// The autoIncrement getter steps are to return true if this’s object store has a key generator, and false otherwise.
|
|
||||||
bool auto_increment() const { return m_key_generator.has_value(); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectStore(String name, bool auto_increment, Optional<KeyPath> const& key_path)
|
ObjectStore(String name, bool auto_increment, Optional<KeyPath> const& key_path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue