mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Add IDBKeyRange
This commit is contained in:
parent
20a92a81c4
commit
48fae7b64f
Notes:
github-actions[bot]
2024-11-26 13:52:44 +00:00
Author: https://github.com/stelar7
Commit: 48fae7b64f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2236
Reviewed-by: https://github.com/gmta ✅
8 changed files with 80 additions and 0 deletions
|
@ -516,6 +516,7 @@ set(SOURCES
|
|||
IndexedDB/IDBFactory.cpp
|
||||
IndexedDB/IDBOpenDBRequest.cpp
|
||||
IndexedDB/IDBIndex.cpp
|
||||
IndexedDB/IDBKeyRange.cpp
|
||||
IndexedDB/IDBObjectStore.cpp
|
||||
IndexedDB/IDBRequest.cpp
|
||||
IndexedDB/IDBTransaction.cpp
|
||||
|
|
|
@ -578,6 +578,7 @@ class IDBCursor;
|
|||
class IDBDatabase;
|
||||
class IDBFactory;
|
||||
class IDBIndex;
|
||||
class IDBKeyRange;
|
||||
class IDBObjectStore;
|
||||
class IDBOpenDBRequest;
|
||||
class IDBRequest;
|
||||
|
|
33
Libraries/LibWeb/IndexedDB/IDBKeyRange.cpp
Normal file
33
Libraries/LibWeb/IndexedDB/IDBKeyRange.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/IDBKeyRangePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/IndexedDB/IDBKeyRange.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(IDBKeyRange);
|
||||
|
||||
IDBKeyRange::~IDBKeyRange() = default;
|
||||
|
||||
IDBKeyRange::IDBKeyRange(JS::Realm& realm)
|
||||
: PlatformObject(realm)
|
||||
{
|
||||
}
|
||||
|
||||
GC::Ref<IDBKeyRange> IDBKeyRange::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.create<IDBKeyRange>(realm);
|
||||
}
|
||||
|
||||
void IDBKeyRange::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBKeyRange);
|
||||
}
|
||||
|
||||
}
|
28
Libraries/LibWeb/IndexedDB/IDBKeyRange.h
Normal file
28
Libraries/LibWeb/IndexedDB/IDBKeyRange.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGC/Heap.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#keyrange
|
||||
class IDBKeyRange : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(IDBKeyRange, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(IDBKeyRange);
|
||||
|
||||
public:
|
||||
virtual ~IDBKeyRange() override;
|
||||
[[nodiscard]] static GC::Ref<IDBKeyRange> create(JS::Realm&);
|
||||
|
||||
protected:
|
||||
explicit IDBKeyRange(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
14
Libraries/LibWeb/IndexedDB/IDBKeyRange.idl
Normal file
14
Libraries/LibWeb/IndexedDB/IDBKeyRange.idl
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Exposed=(Window,Worker)]
|
||||
interface IDBKeyRange {
|
||||
[FIXME] readonly attribute any lower;
|
||||
[FIXME] readonly attribute any upper;
|
||||
[FIXME] readonly attribute boolean lowerOpen;
|
||||
[FIXME] readonly attribute boolean upperOpen;
|
||||
|
||||
[FIXME, NewObject] static IDBKeyRange only(any value);
|
||||
[FIXME, NewObject] static IDBKeyRange lowerBound(any lower, optional boolean open = false);
|
||||
[FIXME, NewObject] static IDBKeyRange upperBound(any upper, optional boolean open = false);
|
||||
[FIXME, NewObject] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
|
||||
|
||||
[FIXME] boolean includes(any key);
|
||||
};
|
|
@ -249,6 +249,7 @@ libweb_js_bindings(IndexedDB/IDBCursor)
|
|||
libweb_js_bindings(IndexedDB/IDBDatabase)
|
||||
libweb_js_bindings(IndexedDB/IDBFactory)
|
||||
libweb_js_bindings(IndexedDB/IDBIndex)
|
||||
libweb_js_bindings(IndexedDB/IDBKeyRange)
|
||||
libweb_js_bindings(IndexedDB/IDBObjectStore)
|
||||
libweb_js_bindings(IndexedDB/IDBOpenDBRequest)
|
||||
libweb_js_bindings(IndexedDB/IDBRequest)
|
||||
|
|
|
@ -61,6 +61,7 @@ static bool is_platform_object(Type const& type)
|
|||
"HTMLCollection"sv,
|
||||
"IDBCursor"sv,
|
||||
"IDBIndex"sv,
|
||||
"IDBKeyRange"sv,
|
||||
"IDBObjectStore"sv,
|
||||
"IDBTransaction"sv,
|
||||
"ImageBitmap"sv,
|
||||
|
|
|
@ -203,6 +203,7 @@ IDBCursor
|
|||
IDBDatabase
|
||||
IDBFactory
|
||||
IDBIndex
|
||||
IDBKeyRange
|
||||
IDBObjectStore
|
||||
IDBOpenDBRequest
|
||||
IDBRequest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue