LibWeb: Implement IDBRequest::ready_state()

This commit is contained in:
stelar7 2024-11-07 20:17:58 +01:00 committed by Jelle Raaijmakers
commit 29ddaa76e7
Notes: github-actions[bot] 2024-11-26 13:52:33 +00:00
3 changed files with 13 additions and 2 deletions

View file

@ -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;
}
}