mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Implement IDBRequest::ready_state()
This commit is contained in:
parent
a4b876b43e
commit
29ddaa76e7
Notes:
github-actions[bot]
2024-11-26 13:52:33 +00:00
Author: https://github.com/stelar7
Commit: 29ddaa76e7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2236
Reviewed-by: https://github.com/gmta ✅
3 changed files with 13 additions and 2 deletions
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/IDBRequestPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/IndexedDB/IDBRequest.h>
|
||||
|
@ -58,4 +58,11 @@ WebIDL::CallbackType* IDBRequest::onerror()
|
|||
return event_handler_attribute(HTML::EventNames::error);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#dom-idbrequest-readystate
|
||||
[[nodiscard]] Bindings::IDBRequestReadyState IDBRequest::ready_state() const
|
||||
{
|
||||
// The readyState getter steps are to return "pending" if this's done flag is false, and "done" otherwise.
|
||||
return m_done ? Bindings::IDBRequestReadyState::Done : Bindings::IDBRequestReadyState::Pending;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/IDBRequestPrototype.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
@ -26,6 +28,8 @@ public:
|
|||
[[nodiscard]] bool processed() const { return m_processed; }
|
||||
[[nodiscard]] IDBRequestSource source() const { return m_source; }
|
||||
|
||||
[[nodiscard]] Bindings::IDBRequestReadyState ready_state() const;
|
||||
|
||||
void set_done(bool done) { m_done = done; }
|
||||
void set_result(JS::Value result) { m_result = result; }
|
||||
void set_error(GC::Ptr<WebIDL::DOMException> error) { m_error = error; }
|
||||
|
|
|
@ -10,7 +10,7 @@ interface IDBRequest : EventTarget {
|
|||
readonly attribute DOMException? error;
|
||||
readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
|
||||
[FIXME] readonly attribute IDBTransaction? transaction;
|
||||
[FIXME] readonly attribute IDBRequestReadyState readyState;
|
||||
readonly attribute IDBRequestReadyState readyState;
|
||||
|
||||
// Event handlers:
|
||||
attribute EventHandler onsuccess;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue