mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 10:41:30 +00:00
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:
parent
e14511468f
commit
da9eaf8788
Notes:
github-actions[bot]
2025-02-05 20:19:50 +00:00
Author: https://github.com/devgianlu
Commit: da9eaf8788
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3117
Reviewed-by: https://github.com/ADKaster ✅
20 changed files with 534 additions and 0 deletions
49
Libraries/LibWeb/CredentialManagement/PasswordCredential.h
Normal file
49
Libraries/LibWeb/CredentialManagement/PasswordCredential.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/PasswordCredentialPrototype.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/CredentialManagement/Credential.h>
|
||||
#include <LibWeb/HTML/HTMLFormElement.h>
|
||||
|
||||
namespace Web::CredentialManagement {
|
||||
|
||||
class PasswordCredential final : public Credential {
|
||||
WEB_PLATFORM_OBJECT(PasswordCredential, Credential);
|
||||
GC_DECLARE_ALLOCATOR(PasswordCredential);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<PasswordCredential> create(JS::Realm&);
|
||||
static WebIDL::ExceptionOr<GC::Ref<PasswordCredential>> construct_impl(JS::Realm&, HTML::HTMLFormElement const&);
|
||||
static WebIDL::ExceptionOr<GC::Ref<PasswordCredential>> construct_impl(JS::Realm&, PasswordCredentialData const&);
|
||||
|
||||
virtual ~PasswordCredential() override;
|
||||
|
||||
String const& password() { return m_password; }
|
||||
|
||||
String type() override { return "password"_string; }
|
||||
|
||||
private:
|
||||
explicit PasswordCredential(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
// TODO: Use Core::SecretString when it comes back
|
||||
String m_password;
|
||||
};
|
||||
|
||||
struct PasswordCredentialData : CredentialData {
|
||||
Optional<String> name;
|
||||
Optional<String> icon_url;
|
||||
String origin;
|
||||
String password;
|
||||
};
|
||||
|
||||
using PasswordCredentialInit = Variant<PasswordCredentialData, GC::Root<HTML::HTMLFormElement>>;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue