mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 12:37:43 +00:00
LibWeb: Move dictionaries to the Bindings namespace
This commit is contained in:
parent
02a85d8259
commit
0afea792e2
2 changed files with 13 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||||
|
* Copyright (c) 2023, stelar7 <dudedbz@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +37,7 @@ void SubtleCrypto::initialize(JS::Realm& realm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/webcrypto/#dfn-normalize-an-algorithm
|
// https://w3c.github.io/webcrypto/#dfn-normalize-an-algorithm
|
||||||
JS::ThrowCompletionOr<SubtleCrypto::Algorithm> SubtleCrypto::normalize_an_algorithm(Variant<JS::Handle<JS::Object>, String> const& algorithm, String operation)
|
JS::ThrowCompletionOr<Bindings::Algorithm> SubtleCrypto::normalize_an_algorithm(Variant<JS::Handle<JS::Object>, String> const& algorithm, String operation)
|
||||||
{
|
{
|
||||||
auto& realm = this->realm();
|
auto& realm = this->realm();
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ JS::ThrowCompletionOr<SubtleCrypto::Algorithm> SubtleCrypto::normalize_an_algori
|
||||||
// 8. Let normalizedAlgorithm be the result of converting the ECMAScript object represented by alg
|
// 8. Let normalizedAlgorithm be the result of converting the ECMAScript object represented by alg
|
||||||
// to the IDL dictionary type desiredType, as defined by [WebIDL].
|
// to the IDL dictionary type desiredType, as defined by [WebIDL].
|
||||||
// FIXME: Should IDL generate a struct for each of these?
|
// FIXME: Should IDL generate a struct for each of these?
|
||||||
SubtleCrypto::Algorithm normalized_algorithm;
|
Bindings::Algorithm normalized_algorithm;
|
||||||
|
|
||||||
// 9. Set the name attribute of normalizedAlgorithm to algName.
|
// 9. Set the name attribute of normalizedAlgorithm to algName.
|
||||||
normalized_algorithm.name = algorithm_name;
|
normalized_algorithm.name = algorithm_name;
|
||||||
|
|
|
@ -10,6 +10,15 @@
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibWeb/Bindings/PlatformObject.h>
|
#include <LibWeb/Bindings/PlatformObject.h>
|
||||||
|
// FIXME: Generate these from IDL
|
||||||
|
namespace Web::Bindings {
|
||||||
|
|
||||||
|
// https://w3c.github.io/webcrypto/#dfn-Algorithm
|
||||||
|
struct Algorithm {
|
||||||
|
String name;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
namespace Web::Crypto {
|
namespace Web::Crypto {
|
||||||
|
|
||||||
|
@ -20,10 +29,6 @@ class SubtleCrypto final : public Bindings::PlatformObject {
|
||||||
using SupportedAlgorithmsMap = HashMap<String, HashMap<String, String, AK::ASCIICaseInsensitiveStringTraits>>;
|
using SupportedAlgorithmsMap = HashMap<String, HashMap<String, String, AK::ASCIICaseInsensitiveStringTraits>>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Algorithm {
|
|
||||||
String name;
|
|
||||||
};
|
|
||||||
|
|
||||||
[[nodiscard]] static JS::NonnullGCPtr<SubtleCrypto> create(JS::Realm&);
|
[[nodiscard]] static JS::NonnullGCPtr<SubtleCrypto> create(JS::Realm&);
|
||||||
|
|
||||||
virtual ~SubtleCrypto() override;
|
virtual ~SubtleCrypto() override;
|
||||||
|
@ -34,7 +39,7 @@ private:
|
||||||
explicit SubtleCrypto(JS::Realm&);
|
explicit SubtleCrypto(JS::Realm&);
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
||||||
JS::ThrowCompletionOr<Algorithm> normalize_an_algorithm(Variant<JS::Handle<JS::Object>, String> const& algorithm, String operation);
|
JS::ThrowCompletionOr<Bindings::Algorithm> normalize_an_algorithm(Variant<JS::Handle<JS::Object>, String> const& algorithm, String operation);
|
||||||
|
|
||||||
static SubtleCrypto::SupportedAlgorithmsMap& supported_algorithms_internal();
|
static SubtleCrypto::SupportedAlgorithmsMap& supported_algorithms_internal();
|
||||||
static SubtleCrypto::SupportedAlgorithmsMap supported_algorithms();
|
static SubtleCrypto::SupportedAlgorithmsMap supported_algorithms();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue