ladybird/Libraries/LibWeb/CredentialManagement/PasswordCredential.cpp
devgianlu da9eaf8788 LibWeb: Stub for Credential Management API
Stub out basic Credential Management APIs and import IDL tests.

Spec: https://w3c.github.io/webappsec-credential-management/
2025-02-05 13:18:47 -07:00

45 lines
1.3 KiB
C++

/*
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/CredentialManagement/PasswordCredential.h>
namespace Web::CredentialManagement {
GC_DEFINE_ALLOCATOR(PasswordCredential);
GC::Ref<PasswordCredential> PasswordCredential::create(JS::Realm& realm)
{
return realm.create<PasswordCredential>(realm);
}
// https://www.w3.org/TR/credential-management-1/#dom-passwordcredential-passwordcredential
WebIDL::ExceptionOr<GC::Ref<PasswordCredential>> PasswordCredential::construct_impl(JS::Realm& realm, HTML::HTMLFormElement const&)
{
return realm.vm().throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "construct"sv);
}
// https://www.w3.org/TR/credential-management-1/#dom-passwordcredential-passwordcredential-data
WebIDL::ExceptionOr<GC::Ref<PasswordCredential>> PasswordCredential::construct_impl(JS::Realm& realm, PasswordCredentialData const&)
{
return realm.vm().throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "construct"sv);
}
PasswordCredential::~PasswordCredential()
{
}
PasswordCredential::PasswordCredential(JS::Realm& realm)
: Credential(realm)
{
}
void PasswordCredential::initialize(JS::Realm& realm)
{
Base::initialize(realm);
WEB_SET_PROTOTYPE_FOR_INTERFACE(PasswordCredential);
}
}