mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibJS: Replace PropertyKey(char[]) with PropertyKey(FlyString)
...and deal with the fallout.
This commit is contained in:
parent
d7908dbff5
commit
53da8893ac
Notes:
github-actions[bot]
2025-03-24 22:28:43 +00:00
Author: https://github.com/awesomekling
Commit: 53da8893ac
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4067
Reviewed-by: https://github.com/trflynn89
55 changed files with 254 additions and 251 deletions
|
@ -337,7 +337,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> AesCbcParams::from_value(J
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto iv_value = TRY(object.get("iv"));
|
||||
auto iv_value = TRY(object.get("iv"_fly_string));
|
||||
if (!iv_value.is_object() || !(is<JS::TypedArrayBase>(iv_value.as_object()) || is<JS::ArrayBuffer>(iv_value.as_object()) || is<JS::DataView>(iv_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
auto iv = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(iv_value.as_object()));
|
||||
|
@ -351,12 +351,12 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> AesCtrParams::from_value(J
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto iv_value = TRY(object.get("counter"));
|
||||
auto iv_value = TRY(object.get("counter"_fly_string));
|
||||
if (!iv_value.is_object() || !(is<JS::TypedArrayBase>(iv_value.as_object()) || is<JS::ArrayBuffer>(iv_value.as_object()) || is<JS::DataView>(iv_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
auto iv = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(iv_value.as_object()));
|
||||
|
||||
auto length_value = TRY(object.get("length"));
|
||||
auto length_value = TRY(object.get("length"_fly_string));
|
||||
auto length = TRY(length_value.to_u8(vm));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new AesCtrParams { iv, length });
|
||||
|
@ -368,22 +368,22 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> AesGcmParams::from_value(J
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto iv_value = TRY(object.get("iv"));
|
||||
auto iv_value = TRY(object.get("iv"_fly_string));
|
||||
if (!iv_value.is_object() || !(is<JS::TypedArrayBase>(iv_value.as_object()) || is<JS::ArrayBuffer>(iv_value.as_object()) || is<JS::DataView>(iv_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
auto iv = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(iv_value.as_object()));
|
||||
|
||||
auto maybe_additional_data = Optional<ByteBuffer> {};
|
||||
if (MUST(object.has_property("additionalData"))) {
|
||||
auto additional_data_value = TRY(object.get("additionalData"));
|
||||
if (MUST(object.has_property("additionalData"_fly_string))) {
|
||||
auto additional_data_value = TRY(object.get("additionalData"_fly_string));
|
||||
if (!additional_data_value.is_object() || !(is<JS::TypedArrayBase>(additional_data_value.as_object()) || is<JS::ArrayBuffer>(additional_data_value.as_object()) || is<JS::DataView>(additional_data_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
maybe_additional_data = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(additional_data_value.as_object()));
|
||||
}
|
||||
|
||||
auto maybe_tag_length = Optional<u8> {};
|
||||
if (MUST(object.has_property("tagLength"))) {
|
||||
auto tag_length_value = TRY(object.get("tagLength"));
|
||||
if (MUST(object.has_property("tagLength"_fly_string))) {
|
||||
auto tag_length_value = TRY(object.get("tagLength"_fly_string));
|
||||
maybe_tag_length = TRY(tag_length_value.to_u8(vm));
|
||||
}
|
||||
|
||||
|
@ -396,15 +396,15 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> HKDFParams::from_value(JS:
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto hash_value = TRY(object.get("hash"));
|
||||
auto hash_value = TRY(object.get("hash"_fly_string));
|
||||
auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value));
|
||||
|
||||
auto salt_value = TRY(object.get("salt"));
|
||||
auto salt_value = TRY(object.get("salt"_fly_string));
|
||||
if (!salt_value.is_object() || !(is<JS::TypedArrayBase>(salt_value.as_object()) || is<JS::ArrayBuffer>(salt_value.as_object()) || is<JS::DataView>(salt_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
auto salt = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(salt_value.as_object()));
|
||||
|
||||
auto info_value = TRY(object.get("info"));
|
||||
auto info_value = TRY(object.get("info"_fly_string));
|
||||
if (!info_value.is_object() || !(is<JS::TypedArrayBase>(info_value.as_object()) || is<JS::ArrayBuffer>(info_value.as_object()) || is<JS::DataView>(info_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
auto info = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(info_value.as_object()));
|
||||
|
@ -418,17 +418,17 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> PBKDF2Params::from_value(J
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto salt_value = TRY(object.get("salt"));
|
||||
auto salt_value = TRY(object.get("salt"_fly_string));
|
||||
|
||||
if (!salt_value.is_object() || !(is<JS::TypedArrayBase>(salt_value.as_object()) || is<JS::ArrayBuffer>(salt_value.as_object()) || is<JS::DataView>(salt_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
|
||||
auto salt = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(salt_value.as_object()));
|
||||
|
||||
auto iterations_value = TRY(object.get("iterations"));
|
||||
auto iterations_value = TRY(object.get("iterations"_fly_string));
|
||||
auto iterations = TRY(iterations_value.to_u32(vm));
|
||||
|
||||
auto hash_value = TRY(object.get("hash"));
|
||||
auto hash_value = TRY(object.get("hash"_fly_string));
|
||||
auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new PBKDF2Params { salt, iterations, hash });
|
||||
|
@ -440,10 +440,10 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> RsaKeyGenParams::from_valu
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto modulus_length_value = TRY(object.get("modulusLength"));
|
||||
auto modulus_length_value = TRY(object.get("modulusLength"_fly_string));
|
||||
auto modulus_length = TRY(modulus_length_value.to_u32(vm));
|
||||
|
||||
auto public_exponent_value = TRY(object.get("publicExponent"));
|
||||
auto public_exponent_value = TRY(object.get("publicExponent"_fly_string));
|
||||
GC::Ptr<JS::Uint8Array> public_exponent;
|
||||
|
||||
if (!public_exponent_value.is_object() || !is<JS::Uint8Array>(public_exponent_value.as_object()))
|
||||
|
@ -460,10 +460,10 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> RsaHashedKeyGenParams::fro
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto modulus_length_value = TRY(object.get("modulusLength"));
|
||||
auto modulus_length_value = TRY(object.get("modulusLength"_fly_string));
|
||||
auto modulus_length = TRY(modulus_length_value.to_u32(vm));
|
||||
|
||||
auto public_exponent_value = TRY(object.get("publicExponent"));
|
||||
auto public_exponent_value = TRY(object.get("publicExponent"_fly_string));
|
||||
GC::Ptr<JS::Uint8Array> public_exponent;
|
||||
|
||||
if (!public_exponent_value.is_object() || !is<JS::Uint8Array>(public_exponent_value.as_object()))
|
||||
|
@ -471,7 +471,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> RsaHashedKeyGenParams::fro
|
|||
|
||||
public_exponent = static_cast<JS::Uint8Array&>(public_exponent_value.as_object());
|
||||
|
||||
auto hash_value = TRY(object.get("hash"));
|
||||
auto hash_value = TRY(object.get("hash"_fly_string));
|
||||
auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new RsaHashedKeyGenParams { modulus_length, big_integer_from_api_big_integer(public_exponent), hash });
|
||||
|
@ -483,7 +483,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> RsaHashedImportParams::fro
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto hash_value = TRY(object.get("hash"));
|
||||
auto hash_value = TRY(object.get("hash"_fly_string));
|
||||
auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new RsaHashedImportParams { hash });
|
||||
|
@ -495,7 +495,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> RsaOaepParams::from_value(
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto label_value = TRY(object.get("label"));
|
||||
auto label_value = TRY(object.get("label"_fly_string));
|
||||
|
||||
ByteBuffer label;
|
||||
if (!label_value.is_nullish()) {
|
||||
|
@ -515,7 +515,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> RsaPssParams::from_value(J
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto salt_length_value = TRY(object.get("saltLength"));
|
||||
auto salt_length_value = TRY(object.get("saltLength"_fly_string));
|
||||
auto salt_length = TRY(salt_length_value.to_u32(vm));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new RsaPssParams { salt_length });
|
||||
|
@ -527,7 +527,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> EcdsaParams::from_value(JS
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto hash_value = TRY(object.get("hash"));
|
||||
auto hash_value = TRY(object.get("hash"_fly_string));
|
||||
auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new EcdsaParams { hash });
|
||||
|
@ -539,7 +539,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> EcKeyGenParams::from_value
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto curve_value = TRY(object.get("namedCurve"));
|
||||
auto curve_value = TRY(object.get("namedCurve"_fly_string));
|
||||
auto curve = TRY(curve_value.to_string(vm));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new EcKeyGenParams { curve });
|
||||
|
@ -551,7 +551,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> AesKeyGenParams::from_valu
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto length_value = TRY(object.get("length"));
|
||||
auto length_value = TRY(object.get("length"_fly_string));
|
||||
auto length = TRY(length_value.to_u16(vm));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new AesKeyGenParams { length });
|
||||
|
@ -563,7 +563,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> AesDerivedKeyParams::from_
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto length_value = TRY(object.get("length"));
|
||||
auto length_value = TRY(object.get("length"_fly_string));
|
||||
auto length = TRY(length_value.to_u16(vm));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new AesDerivedKeyParams { length });
|
||||
|
@ -575,7 +575,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> EcdhKeyDeriveParams::from_
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto key_value = TRY(object.get("public"));
|
||||
auto key_value = TRY(object.get("public"_fly_string));
|
||||
auto key_object = TRY(key_value.to_object(vm));
|
||||
|
||||
if (!is<CryptoKey>(*key_object)) {
|
||||
|
@ -593,7 +593,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> EcKeyImportParams::from_va
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto named_curve_value = TRY(object.get("namedCurve"));
|
||||
auto named_curve_value = TRY(object.get("namedCurve"_fly_string));
|
||||
auto named_curve = TRY(named_curve_value.to_string(vm));
|
||||
|
||||
return adopt_own<AlgorithmParams>(*new EcKeyImportParams { named_curve });
|
||||
|
@ -605,12 +605,12 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> HmacImportParams::from_val
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto hash_value = TRY(object.get("hash"));
|
||||
auto hash_value = TRY(object.get("hash"_fly_string));
|
||||
auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value));
|
||||
|
||||
auto maybe_length = Optional<WebIDL::UnsignedLong> {};
|
||||
if (MUST(object.has_property("length"))) {
|
||||
auto length_value = TRY(object.get("length"));
|
||||
if (MUST(object.has_property("length"_fly_string))) {
|
||||
auto length_value = TRY(object.get("length"_fly_string));
|
||||
maybe_length = TRY(length_value.to_u32(vm));
|
||||
}
|
||||
|
||||
|
@ -623,12 +623,12 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> HmacKeyGenParams::from_val
|
|||
{
|
||||
auto& object = value.as_object();
|
||||
|
||||
auto hash_value = TRY(object.get("hash"));
|
||||
auto hash_value = TRY(object.get("hash"_fly_string));
|
||||
auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value));
|
||||
|
||||
auto maybe_length = Optional<WebIDL::UnsignedLong> {};
|
||||
if (MUST(object.has_property("length"))) {
|
||||
auto length_value = TRY(object.get("length"));
|
||||
if (MUST(object.has_property("length"_fly_string))) {
|
||||
auto length_value = TRY(object.get("length"_fly_string));
|
||||
maybe_length = TRY(length_value.to_u32(vm));
|
||||
}
|
||||
|
||||
|
@ -642,8 +642,8 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> Ed448Params::from_value(JS
|
|||
auto& object = value.as_object();
|
||||
|
||||
auto maybe_context = Optional<ByteBuffer> {};
|
||||
if (MUST(object.has_property("context"))) {
|
||||
auto context_value = TRY(object.get("context"));
|
||||
if (MUST(object.has_property("context"_fly_string))) {
|
||||
auto context_value = TRY(object.get("context"_fly_string));
|
||||
if (!context_value.is_object() || !(is<JS::TypedArrayBase>(context_value.as_object()) || is<JS::ArrayBuffer>(context_value.as_object()) || is<JS::DataView>(context_value.as_object())))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");
|
||||
maybe_context = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(context_value.as_object()));
|
||||
|
|
|
@ -34,7 +34,7 @@ struct HashAlgorithmIdentifier : public AlgorithmIdentifier {
|
|||
auto value = visit(
|
||||
[](String const& name) -> JS::ThrowCompletionOr<String> { return name; },
|
||||
[&](GC::Root<JS::Object> const& obj) -> JS::ThrowCompletionOr<String> {
|
||||
auto name_property = TRY(obj->get("name"));
|
||||
auto name_property = TRY(obj->get("name"_fly_string));
|
||||
return name_property.to_string(vm);
|
||||
});
|
||||
|
||||
|
|
|
@ -91,63 +91,63 @@ JS::ThrowCompletionOr<GC::Ref<JS::Object>> JsonWebKey::to_object(JS::Realm& real
|
|||
auto object = JS::Object::create(realm, realm.intrinsics().object_prototype());
|
||||
|
||||
if (kty.has_value())
|
||||
TRY(object->create_data_property("kty", JS::PrimitiveString::create(vm, kty.value())));
|
||||
TRY(object->create_data_property("kty"_fly_string, JS::PrimitiveString::create(vm, kty.value())));
|
||||
|
||||
if (use.has_value())
|
||||
TRY(object->create_data_property("use", JS::PrimitiveString::create(vm, use.value())));
|
||||
TRY(object->create_data_property("use"_fly_string, JS::PrimitiveString::create(vm, use.value())));
|
||||
|
||||
if (key_ops.has_value()) {
|
||||
auto key_ops_array = JS::Array::create_from<String>(realm, key_ops.value().span(), [&](auto& key_usage) -> JS::Value {
|
||||
return JS::PrimitiveString::create(realm.vm(), key_usage);
|
||||
});
|
||||
TRY(object->create_data_property("key_ops", move(key_ops_array)));
|
||||
TRY(object->create_data_property("key_ops"_fly_string, move(key_ops_array)));
|
||||
}
|
||||
|
||||
if (alg.has_value())
|
||||
TRY(object->create_data_property("alg", JS::PrimitiveString::create(vm, alg.value())));
|
||||
TRY(object->create_data_property("alg"_fly_string, JS::PrimitiveString::create(vm, alg.value())));
|
||||
|
||||
if (ext.has_value())
|
||||
TRY(object->create_data_property("ext", JS::Value(ext.value())));
|
||||
TRY(object->create_data_property("ext"_fly_string, JS::Value(ext.value())));
|
||||
|
||||
if (crv.has_value())
|
||||
TRY(object->create_data_property("crv", JS::PrimitiveString::create(vm, crv.value())));
|
||||
TRY(object->create_data_property("crv"_fly_string, JS::PrimitiveString::create(vm, crv.value())));
|
||||
|
||||
if (x.has_value())
|
||||
TRY(object->create_data_property("x", JS::PrimitiveString::create(vm, x.value())));
|
||||
TRY(object->create_data_property("x"_fly_string, JS::PrimitiveString::create(vm, x.value())));
|
||||
|
||||
if (y.has_value())
|
||||
TRY(object->create_data_property("y", JS::PrimitiveString::create(vm, y.value())));
|
||||
TRY(object->create_data_property("y"_fly_string, JS::PrimitiveString::create(vm, y.value())));
|
||||
|
||||
if (d.has_value())
|
||||
TRY(object->create_data_property("d", JS::PrimitiveString::create(vm, d.value())));
|
||||
TRY(object->create_data_property("d"_fly_string, JS::PrimitiveString::create(vm, d.value())));
|
||||
|
||||
if (n.has_value())
|
||||
TRY(object->create_data_property("n", JS::PrimitiveString::create(vm, n.value())));
|
||||
TRY(object->create_data_property("n"_fly_string, JS::PrimitiveString::create(vm, n.value())));
|
||||
|
||||
if (e.has_value())
|
||||
TRY(object->create_data_property("e", JS::PrimitiveString::create(vm, e.value())));
|
||||
TRY(object->create_data_property("e"_fly_string, JS::PrimitiveString::create(vm, e.value())));
|
||||
|
||||
if (p.has_value())
|
||||
TRY(object->create_data_property("p", JS::PrimitiveString::create(vm, p.value())));
|
||||
TRY(object->create_data_property("p"_fly_string, JS::PrimitiveString::create(vm, p.value())));
|
||||
|
||||
if (q.has_value())
|
||||
TRY(object->create_data_property("q", JS::PrimitiveString::create(vm, q.value())));
|
||||
TRY(object->create_data_property("q"_fly_string, JS::PrimitiveString::create(vm, q.value())));
|
||||
|
||||
if (dp.has_value())
|
||||
TRY(object->create_data_property("dp", JS::PrimitiveString::create(vm, dp.value())));
|
||||
TRY(object->create_data_property("dp"_fly_string, JS::PrimitiveString::create(vm, dp.value())));
|
||||
|
||||
if (dq.has_value())
|
||||
TRY(object->create_data_property("dq", JS::PrimitiveString::create(vm, dq.value())));
|
||||
TRY(object->create_data_property("dq"_fly_string, JS::PrimitiveString::create(vm, dq.value())));
|
||||
|
||||
if (qi.has_value())
|
||||
TRY(object->create_data_property("qi", JS::PrimitiveString::create(vm, qi.value())));
|
||||
TRY(object->create_data_property("qi"_fly_string, JS::PrimitiveString::create(vm, qi.value())));
|
||||
|
||||
if (oth.has_value()) {
|
||||
TODO();
|
||||
}
|
||||
|
||||
if (k.has_value())
|
||||
TRY(object->create_data_property("k", JS::PrimitiveString::create(vm, k.value())));
|
||||
TRY(object->create_data_property("k"_fly_string, JS::PrimitiveString::create(vm, k.value())));
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ void CryptoKey::set_usages(Vector<Bindings::KeyUsage> usages)
|
|||
String CryptoKey::algorithm_name() const
|
||||
{
|
||||
if (m_algorithm_name.is_empty()) {
|
||||
auto name = MUST(m_algorithm->get("name"));
|
||||
auto name = MUST(m_algorithm->get("name"_fly_string));
|
||||
m_algorithm_name = MUST(name.to_string(vm()));
|
||||
}
|
||||
return m_algorithm_name;
|
||||
|
@ -95,8 +95,8 @@ CryptoKeyPair::CryptoKeyPair(JS::Realm& realm, GC::Ref<CryptoKey> public_key, GC
|
|||
|
||||
void CryptoKeyPair::initialize(JS::Realm& realm)
|
||||
{
|
||||
define_native_accessor(realm, "publicKey", public_key_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "privateKey", private_key_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "publicKey"_fly_string, public_key_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "privateKey"_fly_string, private_key_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
|
||||
Base::initialize(realm);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ KeyAlgorithm::KeyAlgorithm(JS::Realm& realm)
|
|||
|
||||
void KeyAlgorithm::initialize(JS::Realm& realm)
|
||||
{
|
||||
define_native_accessor(realm, "name", name_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "name"_fly_string, name_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
Base::initialize(realm);
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,8 @@ void RsaKeyAlgorithm::initialize(JS::Realm& realm)
|
|||
{
|
||||
Base::initialize(realm);
|
||||
|
||||
define_native_accessor(realm, "modulusLength", modulus_length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "publicExponent", public_exponent_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "modulusLength"_fly_string, modulus_length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "publicExponent"_fly_string, public_exponent_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
void RsaKeyAlgorithm::visit_edges(Visitor& visitor)
|
||||
|
@ -146,7 +146,7 @@ void EcKeyAlgorithm::initialize(JS::Realm& realm)
|
|||
{
|
||||
Base::initialize(realm);
|
||||
|
||||
define_native_accessor(realm, "namedCurve", named_curve_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "namedCurve"_fly_string, named_curve_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(EcKeyAlgorithm::named_curve_getter)
|
||||
|
@ -170,7 +170,7 @@ void RsaHashedKeyAlgorithm::initialize(JS::Realm& realm)
|
|||
{
|
||||
Base::initialize(realm);
|
||||
|
||||
define_native_accessor(realm, "hash", hash_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "hash"_fly_string, hash_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(RsaHashedKeyAlgorithm::hash_getter)
|
||||
|
@ -204,7 +204,7 @@ void AesKeyAlgorithm::initialize(JS::Realm& realm)
|
|||
{
|
||||
Base::initialize(realm);
|
||||
|
||||
define_native_accessor(realm, "length", length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "length"_fly_string, length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(AesKeyAlgorithm::length_getter)
|
||||
|
@ -227,8 +227,8 @@ HmacKeyAlgorithm::HmacKeyAlgorithm(JS::Realm& realm)
|
|||
void HmacKeyAlgorithm::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
define_native_accessor(realm, "hash", hash_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "length", length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "hash"_fly_string, hash_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "length"_fly_string, length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
void HmacKeyAlgorithm::visit_edges(JS::Cell::Visitor& visitor)
|
||||
|
|
|
@ -71,7 +71,7 @@ WebIDL::ExceptionOr<NormalizedAlgorithmAndParameter> normalize_an_algorithm(JS::
|
|||
// Return the result of running the normalize an algorithm algorithm,
|
||||
// with the alg set to a new Algorithm dictionary whose name attribute is alg, and with the op set to op.
|
||||
auto dictionary = GC::make_root(JS::Object::create(realm, realm.intrinsics().object_prototype()));
|
||||
TRY(dictionary->create_data_property("name", JS::PrimitiveString::create(vm, algorithm.get<String>())));
|
||||
TRY(dictionary->create_data_property("name"_fly_string, JS::PrimitiveString::create(vm, algorithm.get<String>())));
|
||||
|
||||
return normalize_an_algorithm(realm, dictionary, operation);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ WebIDL::ExceptionOr<NormalizedAlgorithmAndParameter> normalize_an_algorithm(JS::
|
|||
// 3. If an error occurred, return the error and terminate this algorithm.
|
||||
// Note: We're not going to bother creating an Algorithm object, all we want is the name attribute so that we can
|
||||
// fetch the actual algorithm factory from the registeredAlgorithms map.
|
||||
auto initial_algorithm = TRY(algorithm.get<GC::Root<JS::Object>>()->get("name"));
|
||||
auto initial_algorithm = TRY(algorithm.get<GC::Root<JS::Object>>()->get("name"_fly_string));
|
||||
|
||||
if (initial_algorithm.is_undefined()) {
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "Algorithm");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue