LibWeb: Stub for Credential Management API

Stub out basic Credential Management APIs and import IDL tests.

Spec: https://w3c.github.io/webappsec-credential-management/
This commit is contained in:
devgianlu 2025-01-30 22:29:26 +01:00 committed by Andrew Kaster
commit da9eaf8788
Notes: github-actions[bot] 2025-02-05 20:19:50 +00:00
20 changed files with 534 additions and 0 deletions

View file

@ -0,0 +1,45 @@
/*
* 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);
}
}