mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/IDB: Correctly implement IDBRecord getters
This commit is contained in:
parent
244f086709
commit
8fcba173e0
Notes:
github-actions[bot]
2025-10-28 23:26:49 +00:00
Author: https://github.com/stelar7
Commit: 8fcba173e0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6619
Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 17 additions and 2 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/Bindings/IDBRecordPrototype.h>
|
||||
#include <LibWeb/IndexedDB/IDBRecord.h>
|
||||
#include <LibWeb/IndexedDB/Internal/Algorithms.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
|
|
@ -40,4 +41,18 @@ void IDBRecord::visit_edges(Visitor& visitor)
|
|||
visitor.visit(m_primary_key);
|
||||
}
|
||||
|
||||
// https://pr-preview.s3.amazonaws.com/w3c/IndexedDB/pull/461.html#dom-idbrecord-key
|
||||
WebIDL::ExceptionOr<JS::Value> IDBRecord::key() const
|
||||
{
|
||||
// The key getter steps are to return the result of converting a key to a value with this’s key.
|
||||
return convert_a_key_to_a_value(realm(), m_key);
|
||||
}
|
||||
|
||||
// https://pr-preview.s3.amazonaws.com/w3c/IndexedDB/pull/461.html#dom-idbrecord-primarykey
|
||||
WebIDL::ExceptionOr<JS::Value> IDBRecord::primary_key() const
|
||||
{
|
||||
// The primaryKey getter steps are to return the result of converting a key to a value with this’s primary key.
|
||||
return convert_a_key_to_a_value(realm(), m_primary_key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ public:
|
|||
[[nodiscard]] static GC::Ref<IDBRecord> create(JS::Realm& realm, GC::Ref<Key> key, JS::Value value, GC::Ref<Key> primary_key);
|
||||
virtual ~IDBRecord();
|
||||
|
||||
GC::Ref<Key> key() const { return m_key; }
|
||||
GC::Ref<Key> primary_key() const { return m_primary_key; }
|
||||
JS::Value value() const { return m_value; }
|
||||
WebIDL::ExceptionOr<JS::Value> key() const;
|
||||
WebIDL::ExceptionOr<JS::Value> primary_key() const;
|
||||
|
||||
protected:
|
||||
explicit IDBRecord(JS::Realm&, GC::Ref<Key> key, JS::Value value, GC::Ref<Key> primary_key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue