LibWeb: Stub StorageManager idl interface

This commit is contained in:
Jamie Mansfield 2024-08-13 20:54:58 +01:00 committed by Tim Flynn
parent 97d5cf4eef
commit 1b84062c74
Notes: github-actions[bot] 2024-08-16 15:23:18 +00:00
10 changed files with 87 additions and 0 deletions

View file

@ -4163,6 +4163,7 @@ static void generate_using_namespace_definitions(SourceGenerator& generator)
using namespace Web::NavigationTiming;
using namespace Web::PerformanceTimeline;
using namespace Web::UserTiming;
using namespace Web::StorageAPI;
using namespace Web::Streams;
using namespace Web::SVG;
using namespace Web::UIEvents;

View file

@ -0,0 +1,5 @@
source_set("StorageAPI") {
configs += [ "//Userland/Libraries/LibWeb:configs" ]
deps = [ "//Userland/Libraries/LibWeb:all_generated" ]
sources = [ "StorageManager.cpp" ]
}

View file

@ -256,6 +256,7 @@ standard_idl_files = [
"//Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.idl",
"//Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.idl",
"//Userland/Libraries/LibWeb/Selection/Selection.idl",
"//Userland/Libraries/LibWeb/StorageAPI/StorageManager.idl",
"//Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.idl",
"//Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.idl",
"//Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.idl",

View file

@ -317,6 +317,7 @@ ShadowRoot
SharedArrayBuffer
StaticRange
Storage
StorageManager
String
StyleSheet
StyleSheetList

View file

@ -609,6 +609,7 @@ set(SOURCES
ResizeObserver/ResizeObserverSize.cpp
SecureContexts/AbstractOperations.cpp
SRI/SRI.cpp
StorageAPI/StorageManager.cpp
Streams/AbstractOperations.cpp
Streams/ByteLengthQueuingStrategy.cpp
Streams/CountQueuingStrategy.cpp

View file

@ -662,6 +662,10 @@ struct UnderlyingSink;
struct UnderlyingSource;
}
namespace Web::StorageAPI {
class StorageManager;
}
namespace Web::SVG {
class SVGAnimatedLength;
class SVGAnimatedRect;

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/StorageManagerPrototype.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/StorageAPI/StorageManager.h>
namespace Web::StorageAPI {
JS_DEFINE_ALLOCATOR(StorageManager);
WebIDL::ExceptionOr<JS::NonnullGCPtr<StorageManager>> StorageManager::create(JS::Realm& realm)
{
return realm.heap().allocate<StorageManager>(realm, realm);
}
StorageManager::StorageManager(JS::Realm& realm)
: PlatformObject(realm)
{
}
void StorageManager::initialize(JS::Realm& realm)
{
Base::initialize(realm);
WEB_SET_PROTOTYPE_FOR_INTERFACE(StorageManager);
}
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::StorageAPI {
class StorageManager final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(StorageManager, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(StorageManager);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<StorageManager>> create(JS::Realm&);
virtual ~StorageManager() override = default;
private:
StorageManager(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,14 @@
// https://storage.spec.whatwg.org/#storagemanager
[SecureContext, Exposed=(Window,Worker)]
interface StorageManager {
[FIXME] Promise<boolean> persisted();
[FIXME, Exposed=Window] Promise<boolean> persist();
[FIXME] Promise<StorageEstimate> estimate();
};
// https://storage.spec.whatwg.org/#dictdef-storageestimate
dictionary StorageEstimate {
unsigned long long usage;
unsigned long long quota;
};

View file

@ -298,6 +298,7 @@ libweb_js_bindings(SVG/SVGTransformList)
libweb_js_bindings(SVG/SVGTSpanElement)
libweb_js_bindings(SVG/SVGUseElement)
libweb_js_bindings(Selection/Selection)
libweb_js_bindings(StorageAPI/StorageManager)
libweb_js_bindings(UIEvents/FocusEvent)
libweb_js_bindings(UIEvents/KeyboardEvent)
libweb_js_bindings(UIEvents/MouseEvent)