Files
ladybird/Libraries/LibWeb/CredentialManagement/CredentialsContainer.cpp
Shannon Booth 5adfd1c43a LibWeb/Bindings: Generate struct definitions from IDL dictionaries
Previously we were inconsistent by generating code for enum definitions
but not generating code for dictionaries. With future changes to the
IDL generator to expose helpers to convert to and from IDL values
this produced circular depdendencies. To solve this problem, also
generate the dictionary definitions in bindings headers.
2026-05-09 10:49:49 +02:00

60 lines
2.1 KiB
C++

/*
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/CredentialManagement/CredentialsContainer.h>
namespace Web::CredentialManagement {
GC_DEFINE_ALLOCATOR(CredentialsContainer);
GC::Ref<CredentialsContainer> CredentialsContainer::create(JS::Realm& realm)
{
return realm.create<CredentialsContainer>(realm);
}
CredentialsContainer::~CredentialsContainer() { }
// https://www.w3.org/TR/credential-management-1/#dom-credentialscontainer-get
GC::Ref<WebIDL::Promise> CredentialsContainer::get(Bindings::CredentialRequestOptions const&)
{
auto* realm = vm().current_realm();
return WebIDL::create_rejected_promise_from_exception(*realm, vm().throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "get"sv));
}
// https://www.w3.org/TR/credential-management-1/#dom-credentialscontainer-store
GC::Ref<WebIDL::Promise> CredentialsContainer::store(Credential const&)
{
auto* realm = vm().current_realm();
return WebIDL::create_rejected_promise_from_exception(*realm, vm().throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "store"sv));
}
// https://www.w3.org/TR/credential-management-1/#dom-credentialscontainer-create
GC::Ref<WebIDL::Promise> CredentialsContainer::create(Bindings::CredentialCreationOptions const&)
{
auto* realm = vm().current_realm();
return WebIDL::create_rejected_promise_from_exception(*realm, vm().throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "create"sv));
}
// https://www.w3.org/TR/credential-management-1/#dom-credentialscontainer-preventsilentaccess
GC::Ref<WebIDL::Promise> CredentialsContainer::prevent_silent_access()
{
auto* realm = vm().current_realm();
return WebIDL::create_rejected_promise_from_exception(*realm, vm().throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "prevent silent access"sv));
}
CredentialsContainer::CredentialsContainer(JS::Realm& realm)
: PlatformObject(realm)
{
}
void CredentialsContainer::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(CredentialsContainer);
Base::initialize(realm);
}
}