tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

crypto_key_cached_slots.https.any.js (1184B)


      1 // META: title=WebCryptoAPI: CryptoKey cached ECMAScript objects
      2 
      3 // https://w3c.github.io/webcrypto/#dom-cryptokey-algorithm
      4 // https://github.com/servo/servo/issues/33908
      5 
      6 promise_test(function() {
      7    return self.crypto.subtle.generateKey(
      8        {
      9          name: "AES-CTR",
     10          length: 256,
     11        },
     12        true,
     13        ["encrypt"],
     14      ).then(
     15        function(key) {
     16          let a = key.algorithm;
     17          let b = key.algorithm;
     18          assert_true(a === b);
     19        },
     20        function(err) {
     21            assert_unreached("generateKey threw an unexpected error: " + err.toString());
     22        }
     23    );
     24 }, "CryptoKey.algorithm getter returns cached object");
     25 
     26 promise_test(function() {
     27    return self.crypto.subtle.generateKey(
     28        {
     29          name: "AES-CTR",
     30          length: 256,
     31        },
     32        true,
     33        ["encrypt"],
     34      ).then(
     35        function(key) {
     36          let a = key.usages;
     37          let b = key.usages;
     38          assert_true(a === b);
     39        },
     40        function(err) {
     41            assert_unreached("generateKey threw an unexpected error: " + err.toString());
     42        }
     43    );
     44 }, "CryptoKey.usages getter returns cached object");