1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

LibWeb: Make Crypto GC-allocated

This commit is contained in:
Andreas Kling 2022-09-04 13:15:05 +02:00
parent 96f6c7fae5
commit be9d3860b9
6 changed files with 30 additions and 24 deletions

View file

@ -8,15 +8,29 @@
#include <AK/Random.h>
#include <AK/StringBuilder.h>
#include <LibJS/Runtime/TypedArray.h>
#include <LibWeb/Bindings/Wrapper.h>
#include <LibWeb/Crypto/Crypto.h>
#include <LibWeb/Crypto/SubtleCrypto.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Crypto {
Crypto::Crypto(HTML::Window& window)
: m_subtle(*SubtleCrypto::create(window))
JS::NonnullGCPtr<Crypto> Crypto::create(HTML::Window& window)
{
return *window.heap().allocate<Crypto>(window.realm(), window);
}
Crypto::Crypto(HTML::Window& window)
: PlatformObject(window.realm())
{
set_prototype(&window.cached_web_prototype("Crypto"));
}
Crypto::~Crypto() = default;
void Crypto::initialize(JS::Realm& realm)
{
Base::initialize(realm);
m_subtle = SubtleCrypto::create(global_object());
}
JS::NonnullGCPtr<SubtleCrypto> Crypto::subtle() const