mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibWeb: Implement usages property for CryptoKey
And set it from the only place we currently create a CryptoKey, in importKey.
This commit is contained in:
parent
2d59d6c98c
commit
0a6f195a71
Notes:
sideshowbarker
2024-07-17 02:29:45 +09:00
Author: https://github.com/ADKaster
Commit: 0a6f195a71
Pull-request: https://github.com/SerenityOS/serenity/pull/23532
5 changed files with 27 additions and 6 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Memory.h>
|
||||
#include <LibJS/Runtime/Array.h>
|
||||
#include <LibWeb/Crypto/CryptoKey.h>
|
||||
|
||||
namespace Web::Crypto {
|
||||
|
@ -45,4 +46,13 @@ void CryptoKey::visit_edges(Visitor& visitor)
|
|||
visitor.visit(m_usages);
|
||||
}
|
||||
|
||||
void CryptoKey::set_usages(Vector<Bindings::KeyUsage> usages)
|
||||
{
|
||||
m_key_usages = move(usages);
|
||||
auto& realm = this->realm();
|
||||
m_usages = JS::Array::create_from<Bindings::KeyUsage>(realm, m_key_usages.span(), [&](auto& key_usage) -> JS::Value {
|
||||
return JS::PrimitiveString::create(realm.vm(), Bindings::idl_enum_to_string(key_usage));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue