LibWeb: Add using statement for simpler type names

This commit is contained in:
stelar7 2023-12-15 21:07:27 +01:00 committed by Andrew Kaster
parent 0afea792e2
commit 1bf73482f5
Notes: sideshowbarker 2024-07-17 09:56:35 +09:00
2 changed files with 5 additions and 4 deletions

View file

@ -37,7 +37,7 @@ void SubtleCrypto::initialize(JS::Realm& realm)
}
// https://w3c.github.io/webcrypto/#dfn-normalize-an-algorithm
JS::ThrowCompletionOr<Bindings::Algorithm> SubtleCrypto::normalize_an_algorithm(Variant<JS::Handle<JS::Object>, String> const& algorithm, String operation)
JS::ThrowCompletionOr<Bindings::Algorithm> SubtleCrypto::normalize_an_algorithm(AlgorithmIdentifier const& algorithm, String operation)
{
auto& realm = this->realm();
@ -110,7 +110,7 @@ JS::ThrowCompletionOr<Bindings::Algorithm> SubtleCrypto::normalize_an_algorithm(
}
// https://w3c.github.io/webcrypto/#dfn-SubtleCrypto-method-digest
JS::NonnullGCPtr<JS::Promise> SubtleCrypto::digest(Variant<JS::Handle<JS::Object>, String> const& algorithm, JS::Handle<WebIDL::BufferSource> const& data)
JS::NonnullGCPtr<JS::Promise> SubtleCrypto::digest(AlgorithmIdentifier const& algorithm, JS::Handle<WebIDL::BufferSource> const& data)
{
auto& realm = this->realm();

View file

@ -27,19 +27,20 @@ class SubtleCrypto final : public Bindings::PlatformObject {
JS_DECLARE_ALLOCATOR(SubtleCrypto);
using SupportedAlgorithmsMap = HashMap<String, HashMap<String, String, AK::ASCIICaseInsensitiveStringTraits>>;
using AlgorithmIdentifier = Variant<JS::Handle<JS::Object>, String>;
public:
[[nodiscard]] static JS::NonnullGCPtr<SubtleCrypto> create(JS::Realm&);
virtual ~SubtleCrypto() override;
JS::NonnullGCPtr<JS::Promise> digest(Variant<JS::Handle<JS::Object>, String> const& algorithm, JS::Handle<WebIDL::BufferSource> const& data);
JS::NonnullGCPtr<JS::Promise> digest(AlgorithmIdentifier const& algorithm, JS::Handle<WebIDL::BufferSource> const& data);
private:
explicit SubtleCrypto(JS::Realm&);
virtual void initialize(JS::Realm&) override;
JS::ThrowCompletionOr<Bindings::Algorithm> normalize_an_algorithm(Variant<JS::Handle<JS::Object>, String> const& algorithm, String operation);
JS::ThrowCompletionOr<Bindings::Algorithm> normalize_an_algorithm(AlgorithmIdentifier const& algorithm, String operation);
static SubtleCrypto::SupportedAlgorithmsMap& supported_algorithms_internal();
static SubtleCrypto::SupportedAlgorithmsMap supported_algorithms();