mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb/IDB: Implement IDBObjectStore::add
This commit is contained in:
parent
a06cec7a3c
commit
ca1e94f9ea
Notes:
github-actions[bot]
2025-04-23 18:36:55 +00:00
Author: https://github.com/stelar7
Commit: ca1e94f9ea
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4317
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/kennethmyhra ✅
3 changed files with 9 additions and 1 deletions
|
@ -317,4 +317,11 @@ WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::add_or_put(GC::Ref<IDBO
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/IndexedDB/#dom-idbobjectstore-add
|
||||||
|
WebIDL::ExceptionOr<GC::Ref<IDBRequest>> IDBObjectStore::add(JS::Value value, Optional<JS::Value> const& key)
|
||||||
|
{
|
||||||
|
// The add(value, key) method steps are to return the result of running add or put with this, value, key and the no-overwrite flag true.
|
||||||
|
return add_or_put(*this, value, key, true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
WebIDL::ExceptionOr<void> delete_index(String const&);
|
WebIDL::ExceptionOr<void> delete_index(String const&);
|
||||||
|
|
||||||
[[nodiscard]] WebIDL::ExceptionOr<GC::Ref<IDBRequest>> add_or_put(GC::Ref<IDBObjectStore>, JS::Value, Optional<JS::Value> const&, bool);
|
[[nodiscard]] WebIDL::ExceptionOr<GC::Ref<IDBRequest>> add_or_put(GC::Ref<IDBObjectStore>, JS::Value, Optional<JS::Value> const&, bool);
|
||||||
|
[[nodiscard]] WebIDL::ExceptionOr<GC::Ref<IDBRequest>> add(JS::Value value, Optional<JS::Value> const& key);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit IDBObjectStore(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
|
explicit IDBObjectStore(JS::Realm&, GC::Ref<ObjectStore>, GC::Ref<IDBTransaction>);
|
||||||
|
|
|
@ -11,7 +11,7 @@ interface IDBObjectStore {
|
||||||
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);
|
[NewObject] IDBRequest add(any value, optional any key);
|
||||||
[FIXME, NewObject] IDBRequest delete(any query);
|
[FIXME, NewObject] IDBRequest delete(any query);
|
||||||
[FIXME, NewObject] IDBRequest clear();
|
[FIXME, NewObject] IDBRequest clear();
|
||||||
[FIXME, NewObject] IDBRequest get(any query);
|
[FIXME, NewObject] IDBRequest get(any query);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue