mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Stub StorageManager idl interface
This commit is contained in:
parent
97d5cf4eef
commit
1b84062c74
Notes:
github-actions[bot]
2024-08-16 15:23:18 +00:00
Author: https://github.com/jamierocks
Commit: 1b84062c74
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1066
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/trflynn89 ✅
10 changed files with 87 additions and 0 deletions
|
@ -4163,6 +4163,7 @@ static void generate_using_namespace_definitions(SourceGenerator& generator)
|
||||||
using namespace Web::NavigationTiming;
|
using namespace Web::NavigationTiming;
|
||||||
using namespace Web::PerformanceTimeline;
|
using namespace Web::PerformanceTimeline;
|
||||||
using namespace Web::UserTiming;
|
using namespace Web::UserTiming;
|
||||||
|
using namespace Web::StorageAPI;
|
||||||
using namespace Web::Streams;
|
using namespace Web::Streams;
|
||||||
using namespace Web::SVG;
|
using namespace Web::SVG;
|
||||||
using namespace Web::UIEvents;
|
using namespace Web::UIEvents;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
source_set("StorageAPI") {
|
||||||
|
configs += [ "//Userland/Libraries/LibWeb:configs" ]
|
||||||
|
deps = [ "//Userland/Libraries/LibWeb:all_generated" ]
|
||||||
|
sources = [ "StorageManager.cpp" ]
|
||||||
|
}
|
|
@ -256,6 +256,7 @@ standard_idl_files = [
|
||||||
"//Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.idl",
|
"//Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.idl",
|
||||||
"//Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.idl",
|
"//Userland/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.idl",
|
||||||
"//Userland/Libraries/LibWeb/Selection/Selection.idl",
|
"//Userland/Libraries/LibWeb/Selection/Selection.idl",
|
||||||
|
"//Userland/Libraries/LibWeb/StorageAPI/StorageManager.idl",
|
||||||
"//Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.idl",
|
"//Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.idl",
|
||||||
"//Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.idl",
|
"//Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.idl",
|
||||||
"//Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.idl",
|
"//Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.idl",
|
||||||
|
|
|
@ -317,6 +317,7 @@ ShadowRoot
|
||||||
SharedArrayBuffer
|
SharedArrayBuffer
|
||||||
StaticRange
|
StaticRange
|
||||||
Storage
|
Storage
|
||||||
|
StorageManager
|
||||||
String
|
String
|
||||||
StyleSheet
|
StyleSheet
|
||||||
StyleSheetList
|
StyleSheetList
|
||||||
|
|
|
@ -609,6 +609,7 @@ set(SOURCES
|
||||||
ResizeObserver/ResizeObserverSize.cpp
|
ResizeObserver/ResizeObserverSize.cpp
|
||||||
SecureContexts/AbstractOperations.cpp
|
SecureContexts/AbstractOperations.cpp
|
||||||
SRI/SRI.cpp
|
SRI/SRI.cpp
|
||||||
|
StorageAPI/StorageManager.cpp
|
||||||
Streams/AbstractOperations.cpp
|
Streams/AbstractOperations.cpp
|
||||||
Streams/ByteLengthQueuingStrategy.cpp
|
Streams/ByteLengthQueuingStrategy.cpp
|
||||||
Streams/CountQueuingStrategy.cpp
|
Streams/CountQueuingStrategy.cpp
|
||||||
|
|
|
@ -662,6 +662,10 @@ struct UnderlyingSink;
|
||||||
struct UnderlyingSource;
|
struct UnderlyingSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Web::StorageAPI {
|
||||||
|
class StorageManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Web::SVG {
|
namespace Web::SVG {
|
||||||
class SVGAnimatedLength;
|
class SVGAnimatedLength;
|
||||||
class SVGAnimatedRect;
|
class SVGAnimatedRect;
|
||||||
|
|
32
Userland/Libraries/LibWeb/StorageAPI/StorageManager.cpp
Normal file
32
Userland/Libraries/LibWeb/StorageAPI/StorageManager.cpp
Normal 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
27
Userland/Libraries/LibWeb/StorageAPI/StorageManager.h
Normal file
27
Userland/Libraries/LibWeb/StorageAPI/StorageManager.h
Normal 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
14
Userland/Libraries/LibWeb/StorageAPI/StorageManager.idl
Normal file
14
Userland/Libraries/LibWeb/StorageAPI/StorageManager.idl
Normal 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;
|
||||||
|
};
|
|
@ -298,6 +298,7 @@ libweb_js_bindings(SVG/SVGTransformList)
|
||||||
libweb_js_bindings(SVG/SVGTSpanElement)
|
libweb_js_bindings(SVG/SVGTSpanElement)
|
||||||
libweb_js_bindings(SVG/SVGUseElement)
|
libweb_js_bindings(SVG/SVGUseElement)
|
||||||
libweb_js_bindings(Selection/Selection)
|
libweb_js_bindings(Selection/Selection)
|
||||||
|
libweb_js_bindings(StorageAPI/StorageManager)
|
||||||
libweb_js_bindings(UIEvents/FocusEvent)
|
libweb_js_bindings(UIEvents/FocusEvent)
|
||||||
libweb_js_bindings(UIEvents/KeyboardEvent)
|
libweb_js_bindings(UIEvents/KeyboardEvent)
|
||||||
libweb_js_bindings(UIEvents/MouseEvent)
|
libweb_js_bindings(UIEvents/MouseEvent)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue