LibWeb: Add stub interface for IDBRequest

This commit is contained in:
Shannon Booth 2024-05-19 18:03:00 +12:00 committed by Andreas Kling
parent 8d5665ebe1
commit bfa330914d
Notes: sideshowbarker 2024-07-16 23:34:49 +09:00
6 changed files with 77 additions and 0 deletions

View file

@ -448,6 +448,7 @@ set(SOURCES
Infra/JSON.cpp
Infra/Strings.cpp
IndexedDB/IDBFactory.cpp
IndexedDB/IDBRequest.cpp
Internals/Inspector.cpp
Internals/InternalAnimationTimeline.cpp
Internals/Internals.cpp

View file

@ -500,6 +500,7 @@ class Performance;
namespace Web::IndexedDB {
class IDBFactory;
class IDBRequest;
}
namespace Web::Internals {

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/IDBRequestPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/IndexedDB/IDBRequest.h>
namespace Web::IndexedDB {
JS_DEFINE_ALLOCATOR(IDBRequest);
IDBRequest::~IDBRequest() = default;
IDBRequest::IDBRequest(JS::Realm& realm)
: EventTarget(realm)
{
}
void IDBRequest::initialize(JS::Realm& realm)
{
Base::initialize(realm);
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBRequest);
}
}

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/DOM/EventTarget.h>
namespace Web::IndexedDB {
class IDBRequest : public DOM::EventTarget {
WEB_PLATFORM_OBJECT(IDBRequest, EventTarget);
JS_DECLARE_ALLOCATOR(IDBRequest);
public:
virtual ~IDBRequest() override;
protected:
explicit IDBRequest(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,20 @@
#import <DOM/EventTarget.idl>
// https://w3c.github.io/IndexedDB/#idbrequest
[Exposed=(Window,Worker)]
interface IDBRequest : EventTarget {
// FIXME: readonly attribute any result;
// FIXME: readonly attribute DOMException? error;
// FIXME: readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
// FIXME: readonly attribute IDBTransaction? transaction;
// FIXME: readonly attribute IDBRequestReadyState readyState;
// Event handlers:
// FIXME: attribute EventHandler onsuccess;
// FIXME: attribute EventHandler onerror;
};
enum IDBRequestReadyState {
"pending",
"done"
};

View file

@ -217,6 +217,7 @@ libweb_js_bindings(HTML/WorkerLocation)
libweb_js_bindings(HTML/WorkerNavigator)
libweb_js_bindings(HighResolutionTime/Performance)
libweb_js_bindings(IndexedDB/IDBFactory)
libweb_js_bindings(IndexedDB/IDBRequest)
libweb_js_bindings(Internals/Inspector)
libweb_js_bindings(Internals/InternalAnimationTimeline)
libweb_js_bindings(Internals/Internals)