script: Return cached object from CryptoKey.usages getter (#39564)

Create and store a cached object in `CryptoKey` for the `[[usages]]`
internal slot when the key is created or when its `[[usages]]` internal
slot is updated. The getter can then return the cached object as
specified in https://w3c.github.io/webcrypto/#dom-cryptokey-usages,
instead of creating a new object on each call.

Testing: Pass WPT tests that were expected to fail.

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
Kingsley Yung 2025-09-30 11:56:12 +08:00 committed by GitHub
parent 1accf6d5db
commit 34979c8b71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 13 deletions

View file

@ -1,8 +0,0 @@
[crypto_key_cached_slots.https.any.worker.html]
[CryptoKey.usages getter returns cached object]
expected: FAIL
[crypto_key_cached_slots.https.any.html]
[CryptoKey.usages getter returns cached object]
expected: FAIL