mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
LibWeb: Implement IDBRequest::source()
This commit is contained in:
parent
48fae7b64f
commit
a4b876b43e
Notes:
github-actions[bot]
2024-11-26 13:52:39 +00:00
Author: https://github.com/stelar7
Commit: a4b876b43e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2236
Reviewed-by: https://github.com/gmta ✅
2 changed files with 10 additions and 2 deletions
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
namespace Web::IndexedDB {
|
namespace Web::IndexedDB {
|
||||||
|
|
||||||
|
using IDBRequestSource = Variant<Empty, GC::Ref<IDBObjectStore>, GC::Ref<IDBIndex>, GC::Ref<IDBCursor>>;
|
||||||
|
|
||||||
class IDBRequest : public DOM::EventTarget {
|
class IDBRequest : public DOM::EventTarget {
|
||||||
WEB_PLATFORM_OBJECT(IDBRequest, DOM::EventTarget);
|
WEB_PLATFORM_OBJECT(IDBRequest, DOM::EventTarget);
|
||||||
GC_DECLARE_ALLOCATOR(IDBRequest);
|
GC_DECLARE_ALLOCATOR(IDBRequest);
|
||||||
|
@ -22,11 +24,13 @@ public:
|
||||||
[[nodiscard]] GC::Ptr<WebIDL::DOMException> error() const { return m_error; }
|
[[nodiscard]] GC::Ptr<WebIDL::DOMException> error() const { return m_error; }
|
||||||
[[nodiscard]] bool done() const { return m_done; }
|
[[nodiscard]] bool done() const { return m_done; }
|
||||||
[[nodiscard]] bool processed() const { return m_processed; }
|
[[nodiscard]] bool processed() const { return m_processed; }
|
||||||
|
[[nodiscard]] IDBRequestSource source() const { return m_source; }
|
||||||
|
|
||||||
void set_done(bool done) { m_done = done; }
|
void set_done(bool done) { m_done = done; }
|
||||||
void set_result(JS::Value result) { m_result = result; }
|
void set_result(JS::Value result) { m_result = result; }
|
||||||
void set_error(GC::Ptr<WebIDL::DOMException> error) { m_error = error; }
|
void set_error(GC::Ptr<WebIDL::DOMException> error) { m_error = error; }
|
||||||
void set_processed(bool processed) { m_processed = processed; }
|
void set_processed(bool processed) { m_processed = processed; }
|
||||||
|
void set_source(IDBRequestSource source) { m_source = source; }
|
||||||
|
|
||||||
void set_onsuccess(WebIDL::CallbackType*);
|
void set_onsuccess(WebIDL::CallbackType*);
|
||||||
WebIDL::CallbackType* onsuccess();
|
WebIDL::CallbackType* onsuccess();
|
||||||
|
@ -47,7 +51,8 @@ private:
|
||||||
// A request has a result and an error
|
// A request has a result and an error
|
||||||
JS::Value m_result;
|
JS::Value m_result;
|
||||||
GC::Ptr<WebIDL::DOMException> m_error;
|
GC::Ptr<WebIDL::DOMException> m_error;
|
||||||
// FIXME: A request has a source object.
|
// A request has a source object.
|
||||||
|
IDBRequestSource m_source;
|
||||||
// FIXME: A request has a transaction which is initially null.
|
// FIXME: A request has a transaction which is initially null.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#import <DOM/EventTarget.idl>
|
#import <DOM/EventTarget.idl>
|
||||||
|
#import <IndexedDB/IDBCursor.idl>
|
||||||
|
#import <IndexedDB/IDBIndex.idl>
|
||||||
|
#import <IndexedDB/IDBObjectStore.idl>
|
||||||
|
|
||||||
// https://w3c.github.io/IndexedDB/#idbrequest
|
// https://w3c.github.io/IndexedDB/#idbrequest
|
||||||
[Exposed=(Window,Worker)]
|
[Exposed=(Window,Worker)]
|
||||||
interface IDBRequest : EventTarget {
|
interface IDBRequest : EventTarget {
|
||||||
readonly attribute any result;
|
readonly attribute any result;
|
||||||
readonly attribute DOMException? error;
|
readonly attribute DOMException? error;
|
||||||
[FIXME] readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
|
readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
|
||||||
[FIXME] readonly attribute IDBTransaction? transaction;
|
[FIXME] readonly attribute IDBTransaction? transaction;
|
||||||
[FIXME] readonly attribute IDBRequestReadyState readyState;
|
[FIXME] readonly attribute IDBRequestReadyState readyState;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue