1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

LibWeb: Make SubtleCrypto GC-allocated

This commit is contained in:
Andreas Kling 2022-09-03 19:59:53 +02:00
parent 2ac8e3db3a
commit 7a9b8ced38
8 changed files with 38 additions and 29 deletions

View file

@ -7,31 +7,24 @@
#pragma once
#include <LibJS/Forward.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::Crypto {
class SubtleCrypto
: public Bindings::Wrappable
, public RefCounted<SubtleCrypto> {
public:
using WrapperType = Bindings::SubtleCryptoWrapper;
class SubtleCrypto final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SubtleCrypto, Bindings::PlatformObject);
static NonnullRefPtr<SubtleCrypto> create()
{
return adopt_ref(*new SubtleCrypto());
}
public:
static JS::NonnullGCPtr<SubtleCrypto> create(HTML::Window&);
virtual ~SubtleCrypto() override;
JS::Promise* digest(String const& algorithm, JS::Handle<JS::Object> const& data);
private:
SubtleCrypto() = default;
explicit SubtleCrypto(HTML::Window&);
};
}
namespace Web::Bindings {
SubtleCryptoWrapper* wrap(JS::Realm&, Crypto::SubtleCrypto&);
}
WRAPPER_HACK(SubtleCrypto, Web::Crypto)