Skip to content

Commit

Permalink
[WebCryptoAPI] Test usages slot being cached (#49453)
Browse files Browse the repository at this point in the history
  • Loading branch information
panva authored Dec 2, 2024
1 parent 6083f43 commit 3e3374e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 24 deletions.
44 changes: 44 additions & 0 deletions WebCryptoAPI/crypto_key_cached_slots.https.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// META: title=WebCryptoAPI: CryptoKey cached ECMAScript objects

// https://w3c.github.io/webcrypto/#dom-cryptokey-algorithm
// https://github.com/servo/servo/issues/33908

promise_test(function() {
return self.crypto.subtle.generateKey(
{
name: "AES-CTR",
length: 256,
},
true,
["encrypt"],
).then(
function(key) {
let a = key.algorithm;
let b = key.algorithm;
assert_true(a === b);
},
function(err) {
assert_unreached("generateKey threw an unexpected error: " + err.toString());
}
);
}, "CryptoKey.algorithm getter returns cached object");

promise_test(function() {
return self.crypto.subtle.generateKey(
{
name: "AES-CTR",
length: 256,
},
true,
["encrypt"],
).then(
function(key) {
let a = key.usages;
let b = key.usages;
assert_true(a === b);
},
function(err) {
assert_unreached("generateKey threw an unexpected error: " + err.toString());
}
);
}, "CryptoKey.usages getter returns cached object");

This file was deleted.

0 comments on commit 3e3374e

Please sign in to comment.