mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-22 16:09:23 +00:00
LibWeb: Fix else-after-return in hash_algorithm_identifier_from_value
and constify it :^)
This commit is contained in:
parent
3ef65e45d7
commit
1678231eed
Notes:
github-actions[bot]
2025-08-22 08:48:15 +00:00
Author: https://github.com/rmg-x
Commit: 1678231eed
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5948
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 8 additions and 8 deletions
|
@ -39,21 +39,21 @@
|
|||
|
||||
namespace Web::Crypto {
|
||||
|
||||
static JS::ThrowCompletionOr<HashAlgorithmIdentifier> hash_algorithm_identifier_from_value(JS::VM& vm, JS::Value hash_value)
|
||||
static JS::ThrowCompletionOr<HashAlgorithmIdentifier> hash_algorithm_identifier_from_value(JS::VM& vm, JS::Value const hash_value)
|
||||
{
|
||||
auto* realm = vm.current_realm();
|
||||
|
||||
auto maybe_normalized_algorithm = [&]() -> WebIDL::ExceptionOr<NormalizedAlgorithmAndParameter> {
|
||||
if (hash_value.is_string()) {
|
||||
auto hash_string = TRY(hash_value.to_string(vm));
|
||||
auto const hash_string = TRY(hash_value.to_string(vm));
|
||||
return normalize_an_algorithm(*realm, hash_string, "digest"_string);
|
||||
} else if (hash_value.is_object()) {
|
||||
auto hash_object = TRY(hash_value.to_object(vm));
|
||||
auto hash_object_root = GC::make_root(hash_object);
|
||||
return normalize_an_algorithm(*realm, hash_object_root, "digest"_string);
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
if (hash_value.is_object()) {
|
||||
auto const hash_object = TRY(hash_value.to_object(vm));
|
||||
auto const hash_object_root = GC::make_root(hash_object);
|
||||
return normalize_an_algorithm(*realm, hash_object_root, "digest"_string);
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}();
|
||||
|
||||
if (maybe_normalized_algorithm.is_error()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue