mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Update SubtleCrypto IDL according to latest spec
I suppose the IDL definition for `deriveBits` changed to make the last parameter optional.
This commit is contained in:
parent
a95303de02
commit
4b87467fc2
Notes:
github-actions[bot]
2024-12-18 12:19:47 +00:00
Author: https://github.com/devgianlu
Commit: 4b87467fc2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2951
Reviewed-by: https://github.com/gmta ✅
3 changed files with 6 additions and 5 deletions
|
@ -598,7 +598,7 @@ JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> SubtleCrypto::verify(AlgorithmId
|
|||
}
|
||||
|
||||
// https://w3c.github.io/webcrypto/#SubtleCrypto-method-deriveBits
|
||||
JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> SubtleCrypto::derive_bits(AlgorithmIdentifier algorithm, GC::Ref<CryptoKey> base_key, u32 length)
|
||||
JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> SubtleCrypto::derive_bits(AlgorithmIdentifier algorithm, GC::Ref<CryptoKey> base_key, Optional<u32> length_optional)
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
// 1. Let algorithm, baseKey and length, be the algorithm, baseKey and length parameters passed to the deriveBits() method, respectively.
|
||||
|
@ -614,7 +614,7 @@ JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> SubtleCrypto::derive_bits(Algori
|
|||
auto promise = WebIDL::create_promise(realm);
|
||||
|
||||
// 5. Return promise and perform the remaining steps in parallel.
|
||||
Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(realm.heap(), [&realm, normalized_algorithm = normalized_algorithm.release_value(), promise, base_key, length]() -> void {
|
||||
Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(realm.heap(), [&realm, normalized_algorithm = normalized_algorithm.release_value(), promise, base_key, length_optional]() -> void {
|
||||
HTML::TemporaryExecutionContext context(realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes);
|
||||
// 6. If the following steps or referenced procedures say to throw an error, reject promise with the returned error and then terminate the algorithm.
|
||||
|
||||
|
@ -631,7 +631,7 @@ JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> SubtleCrypto::derive_bits(Algori
|
|||
}
|
||||
|
||||
// 9. Let result be the result of creating an ArrayBuffer containing the result of performing the derive bits operation specified by normalizedAlgorithm using baseKey, algorithm and length.
|
||||
auto result = normalized_algorithm.methods->derive_bits(*normalized_algorithm.parameter, base_key, length);
|
||||
auto result = normalized_algorithm.methods->derive_bits(*normalized_algorithm.parameter, base_key, length_optional);
|
||||
if (result.is_error()) {
|
||||
WebIDL::reject_promise(realm, promise, Bindings::exception_to_throw_completion(realm.vm(), result.release_error()).release_value().value());
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue