Bug 1473451 [wpt PR 11793] - Update the WebCryptoAPI IDL file, a=testonly
authorLuke Bjerring <lukebjerring@users.noreply.github.com>
Sat, 07 Jul 2018 07:54:52 +0000
changeset 426093 955dae017de08cb1dd65aa9508720a207c007fc4
parent 426092 393fd99d44fa954d75402eea5f1c22daf2751017
child 426094 00dd4222aa597be1e73683720b97bcc51b7c7832
push id105141
push userjames@hoppipolla.co.uk
push dateWed, 11 Jul 2018 07:44:38 +0000
treeherdermozilla-inbound@b06fa226ba6d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1473451, 11793
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1473451 [wpt PR 11793] - Update the WebCryptoAPI IDL file, a=testonly Automatic update from web-platform-testsUpdate the WebCryptoAPI IDL file (#11793) -- wpt-commits: 7997e96e5a24c24dd6300880f1e9ba80c61886d3 wpt-pr: 11793
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/WebCryptoAPI/idlharness.https.any.js
testing/web-platform/tests/WebCryptoAPI/idlharness.https.html
testing/web-platform/tests/WebCryptoAPI/idlharness.https.worker.js
testing/web-platform/tests/interfaces/WebCryptoAPI.idl
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -311558,25 +311558,23 @@
      "/WebCryptoAPI/getRandomValues.any.html",
      {}
     ],
     [
      "/WebCryptoAPI/getRandomValues.any.worker.html",
      {}
     ]
    ],
-   "WebCryptoAPI/idlharness.https.html": [
-    [
-     "/WebCryptoAPI/idlharness.https.html",
-     {}
-    ]
-   ],
-   "WebCryptoAPI/idlharness.https.worker.js": [
-    [
-     "/WebCryptoAPI/idlharness.https.worker.html",
+   "WebCryptoAPI/idlharness.https.any.js": [
+    [
+     "/WebCryptoAPI/idlharness.https.any.html",
+     {}
+    ],
+    [
+     "/WebCryptoAPI/idlharness.https.any.worker.html",
      {}
     ]
    ],
    "WebCryptoAPI/import_export/ec_importKey.https.worker.js": [
     [
      "/WebCryptoAPI/import_export/ec_importKey.https.worker.html",
      {}
     ]
@@ -415973,22 +415971,18 @@
   "WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.https.any.js": [
    "7a507269004b76a7455cb41e476f69178fed7162",
    "testharness"
   ],
   "WebCryptoAPI/getRandomValues.any.js": [
    "44475110f616c78bc04b93246f015e7a83e78fa7",
    "testharness"
   ],
-  "WebCryptoAPI/idlharness.https.html": [
-   "a0ac6f063c49d9c14b614dee18b681968eee05ad",
-   "testharness"
-  ],
-  "WebCryptoAPI/idlharness.https.worker.js": [
-   "2ef22c6a9f185492c5bca7e52b3a7a6b363a2e2f",
+  "WebCryptoAPI/idlharness.https.any.js": [
+   "c96f061be232a56e65b5c82bf1ce5fef664e183b",
    "testharness"
   ],
   "WebCryptoAPI/import_export/ec_importKey.https.worker.js": [
    "18e1f688107b6f2ec4d37f593567ec65ac95c9f9",
    "testharness"
   ],
   "WebCryptoAPI/import_export/ec_importKey.js": [
    "9da62f7432c2bf0268189f3ba58d5f6910b8de09",
@@ -593674,17 +593668,17 @@
    "2835174993c1648c5f8e2a4639727118d62e2d77",
    "support"
   ],
   "interfaces/ServiceWorker.idl": [
    "7884feabcb4c9d0a447cccfa2359e3c45eef5455",
    "support"
   ],
   "interfaces/WebCryptoAPI.idl": [
-   "1fa169a6badb1c21608f1e1a68075939e913603f",
+   "2275602ab1a7b6bdfebff1b886753bec32e1cbd4",
    "support"
   ],
   "interfaces/WebIDL.idl": [
    "62e56d5f08d5044fc3ee79ac3549d7222f4186aa",
    "support"
   ],
   "interfaces/accelerometer.idl": [
    "07fc457b582a7abb689f923522c65fcce10d27a4",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/idlharness.https.any.js
@@ -0,0 +1,16 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+// https://w3c.github.io/webcrypto/Overview.html
+
+promise_test(async () => {
+  const idl = await fetch(`/interfaces/WebCryptoAPI.idl`).then(r => r.text());
+
+  const idl_array = new IdlArray();
+  idl_array.add_idls(idl);
+  idl_array.add_objects({
+    Crypto: ['crypto'],
+    SubtleCrypto: ['crypto.subtle']
+  });
+  idl_array.test();
+}, 'WebCryptoAPI interfaces');
deleted file mode 100644
--- a/testing/web-platform/tests/WebCryptoAPI/idlharness.https.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!doctype html>
-<html>
-<head>
-<meta charset=utf-8>
-<title>IDL check of WebCrypto</title>
-<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#crypto-interface">
-
-<script src=/resources/testharness.js></script>
-<script src=/resources/testharnessreport.js></script>
-<script src=/resources/WebIDLParser.js></script>
-<script src=/resources/idlharness.js></script>
-</head>
-<body>
-
-<h1 class="instructions">Description</h1>
-
-<p class="instructions">This test verifies that the implementations of the WebCrypto API match with its WebIDL definition.</p>
-
-<div id='log'></div>
-
-<script>
-var file_input;
-setup(function() {
-    var idl_array = new IdlArray();
-
-    var request = new XMLHttpRequest();
-    request.open("GET", "../interfaces/WebCryptoAPI.idl");
-    request.send();
-    request.onload = function() {
-        var idls = request.responseText;
-
-        idl_array.add_idls(idls);
-
-        idl_array.add_objects({"Crypto":["crypto"], "SubtleCrypto":["crypto.subtle"]});
-
-        idl_array.test();
-        done();
-  };
-}, {explicit_done: true});
-</script>
deleted file mode 100644
--- a/testing/web-platform/tests/WebCryptoAPI/idlharness.https.worker.js
+++ /dev/null
@@ -1,22 +0,0 @@
-importScripts("/resources/testharness.js");
-importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
-
-var request = new XMLHttpRequest();
-request.open("GET", "../interfaces/WebCryptoAPI.idl");
-request.send();
-request.onload = function() {
-    var idl_array = new IdlArray();
-    var idls = request.responseText;
-
-    idl_array.add_untested_idls("[Global] interface Window { };");
-
-    idl_array.add_untested_idls("interface ArrayBuffer {};");
-    idl_array.add_untested_idls("interface ArrayBufferView {};");
-
-    idl_array.add_idls(idls);
-
-    idl_array.add_objects({"Crypto":["crypto"], "SubtleCrypto":["crypto.subtle"]});
-
-    idl_array.test();
-    done();
-};
--- a/testing/web-platform/tests/interfaces/WebCryptoAPI.idl
+++ b/testing/web-platform/tests/interfaces/WebCryptoAPI.idl
@@ -1,50 +1,54 @@
-[NoInterfaceObject]
-interface GlobalCrypto {
+// GENERATED CONTENT - DO NOT EDIT
+// Content of this file was automatically extracted from the
+// "Web Cryptography API" spec.
+// See: https://w3c.github.io/webcrypto/Overview.html
+
+partial interface mixin WindowOrWorkerGlobalScope {
   readonly attribute Crypto crypto;
 };
 
-//Window implements GlobalCrypto;
-//WorkerGlobalScope implements GlobalCrypto;
-
 [Exposed=(Window,Worker)]
 interface Crypto {
-  readonly attribute SubtleCrypto subtle;
+  [SecureContext] readonly attribute SubtleCrypto subtle;
   ArrayBufferView getRandomValues(ArrayBufferView array);
 };
 
+
 typedef (object or DOMString) AlgorithmIdentifier;
 
 typedef AlgorithmIdentifier HashAlgorithmIdentifier;
 
 dictionary Algorithm {
   required DOMString name;
 };
 
+
 dictionary KeyAlgorithm {
   required DOMString name;
 };
 
+
 enum KeyType { "public", "private", "secret" };
 
 enum KeyUsage { "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", "unwrapKey" };
 
-[Exposed=(Window,Worker)]
+[SecureContext,Exposed=(Window,Worker)]
 interface CryptoKey {
   readonly attribute KeyType type;
   readonly attribute boolean extractable;
   readonly attribute object algorithm;
   readonly attribute object usages;
 };
 
 
 enum KeyFormat { "raw", "spki", "pkcs8", "jwk" };
 
-[Exposed=(Window,Worker)]
+[SecureContext,Exposed=(Window,Worker)]
 interface SubtleCrypto {
   Promise<any> encrypt(AlgorithmIdentifier algorithm,
                        CryptoKey key,
                        BufferSource data);
   Promise<any> decrypt(AlgorithmIdentifier algorithm,
                        CryptoKey key,
                        BufferSource data);
   Promise<any> sign(AlgorithmIdentifier algorithm,
@@ -60,42 +64,43 @@ interface SubtleCrypto {
   Promise<any> generateKey(AlgorithmIdentifier algorithm,
                           boolean extractable,
                           sequence<KeyUsage> keyUsages );
   Promise<any> deriveKey(AlgorithmIdentifier algorithm,
                          CryptoKey baseKey,
                          AlgorithmIdentifier derivedKeyType,
                          boolean extractable,
                          sequence<KeyUsage> keyUsages );
-  Promise<any> deriveBits(AlgorithmIdentifier algorithm,
+  Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm,
                           CryptoKey baseKey,
                           unsigned long length);
 
-  Promise<any> importKey(KeyFormat format,
+  Promise<CryptoKey> importKey(KeyFormat format,
                          (BufferSource or JsonWebKey) keyData,
                          AlgorithmIdentifier algorithm,
                          boolean extractable,
                          sequence<KeyUsage> keyUsages );
   Promise<any> exportKey(KeyFormat format, CryptoKey key);
 
   Promise<any> wrapKey(KeyFormat format,
                        CryptoKey key,
                        CryptoKey wrappingKey,
                        AlgorithmIdentifier wrapAlgorithm);
-  Promise<any> unwrapKey(KeyFormat format,
+  Promise<CryptoKey> unwrapKey(KeyFormat format,
                          BufferSource wrappedKey,
                          CryptoKey unwrappingKey,
                          AlgorithmIdentifier unwrapAlgorithm,
                          AlgorithmIdentifier unwrappedKeyAlgorithm,
                          boolean extractable,
                          sequence<KeyUsage> keyUsages );
 };
 
+
 dictionary RsaOtherPrimesInfo {
- // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms
+  // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms
   DOMString r;
   DOMString d;
   DOMString t;
 };
 
 dictionary JsonWebKey {
   // The following fields are defined in Section 3.1 of JSON Web Key
   DOMString kty;
@@ -117,161 +122,186 @@ dictionary JsonWebKey {
   DOMString q;
   DOMString dp;
   DOMString dq;
   DOMString qi;
   sequence<RsaOtherPrimesInfo> oth;
   DOMString k;
 };
 
+
 typedef Uint8Array BigInteger;
 
+
 dictionary CryptoKeyPair {
   CryptoKey publicKey;
   CryptoKey privateKey;
 };
 
+
 dictionary RsaKeyGenParams : Algorithm {
   // The length, in bits, of the RSA modulus
   required [EnforceRange] unsigned long modulusLength;
   // The RSA public exponent
   required BigInteger publicExponent;
 };
 
+
 dictionary RsaHashedKeyGenParams : RsaKeyGenParams {
   // The hash algorithm to use
   required HashAlgorithmIdentifier hash;
 };
 
+
 dictionary RsaKeyAlgorithm : KeyAlgorithm {
   // The length, in bits, of the RSA modulus
   required unsigned long modulusLength;
   // The RSA public exponent
   required BigInteger publicExponent;
 };
 
+
 dictionary RsaHashedKeyAlgorithm : RsaKeyAlgorithm {
   // The hash algorithm that is used with this key
   required KeyAlgorithm hash;
 };
 
-dictionary RsaHashedImportParams {
+
+dictionary RsaHashedImportParams : Algorithm {
   // The hash algorithm to use
   required HashAlgorithmIdentifier hash;
 };
 
+
 dictionary RsaPssParams : Algorithm {
-// The desired length of the random salt
-[EnforceRange] required unsigned long saltLength;
+  // The desired length of the random salt
+  [EnforceRange] required unsigned long saltLength;
 };
 
+
 dictionary RsaOaepParams : Algorithm {
-// The optional label/application data to associate with the message
-BufferSource label;
+  // The optional label/application data to associate with the message
+  BufferSource label;
 };
 
+
 dictionary EcdsaParams : Algorithm {
-// The hash algorithm to use
-required HashAlgorithmIdentifier hash;
+  // The hash algorithm to use
+  required HashAlgorithmIdentifier hash;
 };
 
+
 typedef DOMString NamedCurve;
 
 dictionary EcKeyGenParams : Algorithm {
-// A named curve
-required NamedCurve namedCurve;
+  // A named curve
+  required NamedCurve namedCurve;
 };
 
+
 dictionary EcKeyAlgorithm : KeyAlgorithm {
-// The named curve that the key uses
-required NamedCurve namedCurve;
+  // The named curve that the key uses
+  required NamedCurve namedCurve;
 };
 
+
 dictionary EcKeyImportParams : Algorithm {
-// A named curve
-required NamedCurve namedCurve;
+  // A named curve
+  required NamedCurve namedCurve;
 };
 
+
 dictionary EcdhKeyDeriveParams : Algorithm {
-// The peer's EC public key.
-required CryptoKey public;
+  // The peer's EC public key.
+  required CryptoKey public;
 };
 
+
 dictionary AesCtrParams : Algorithm {
-// The initial value of the counter block. counter MUST be 16 bytes
-// (the AES block size). The counter bits are the rightmost length
-// bits of the counter block. The rest of the counter block is for
-// the nonce. The counter bits are incremented using the standard
-// incrementing function specified in NIST SP 800-38A Appendix B.1:
-// the counter bits are interpreted as a big-endian integer and
-// incremented by one.
-required BufferSource counter;
-// The length, in bits, of the rightmost part of the counter block
-// that is incremented.
-[EnforceRange] required octet length;
+  // The initial value of the counter block. counter MUST be 16 bytes
+  // (the AES block size). The counter bits are the rightmost length
+  // bits of the counter block. The rest of the counter block is for
+  // the nonce. The counter bits are incremented using the standard
+  // incrementing function specified in NIST SP 800-38A Appendix B.1:
+  // the counter bits are interpreted as a big-endian integer and
+  // incremented by one.
+  required BufferSource counter;
+  // The length, in bits, of the rightmost part of the counter block
+  // that is incremented.
+  [EnforceRange] required octet length;
 };
 
+
 dictionary AesKeyAlgorithm : KeyAlgorithm {
-// The length, in bits, of the key.
-required unsigned short length;
+  // The length, in bits, of the key.
+  required unsigned short length;
 };
 
+
 dictionary AesKeyGenParams : Algorithm {
-// The length, in bits, of the key.
-[EnforceRange] required unsigned short length;
+  // The length, in bits, of the key.
+  [EnforceRange] required unsigned short length;
 };
 
+
 dictionary AesDerivedKeyParams : Algorithm {
-// The length, in bits, of the key.
-[EnforceRange] required unsigned short length;
+  // The length, in bits, of the key.
+  [EnforceRange] required unsigned short length;
 };
 
+
 dictionary AesCbcParams : Algorithm {
-// The initialization vector. MUST be 16 bytes.
-required BufferSource iv;
+  // The initialization vector. MUST be 16 bytes.
+  required BufferSource iv;
 };
 
+
 dictionary AesGcmParams : Algorithm {
-// The initialization vector to use. May be up to 2^64-1 bytes long.
-required BufferSource iv;
-// The additional authentication data to include.
-BufferSource additionalData;
-// The desired length of the authentication tag. May be 0 - 128.
-[EnforceRange] octet tagLength;
+  // The initialization vector to use. May be up to 2^64-1 bytes long.
+  required BufferSource iv;
+  // The additional authentication data to include.
+  BufferSource additionalData;
+  // The desired length of the authentication tag. May be 0 - 128.
+  [EnforceRange] octet tagLength;
 };
 
+
 dictionary HmacImportParams : Algorithm {
-// The inner hash function to use.
-HashAlgorithmIdentifier hash;
-// The length (in bits) of the key.
-[EnforceRange] unsigned long length;
+  // The inner hash function to use.
+  required HashAlgorithmIdentifier hash;
+  // The length (in bits) of the key.
+  [EnforceRange] unsigned long length;
 };
 
+
 dictionary HmacKeyAlgorithm : KeyAlgorithm {
-// The inner hash function to use.
-required KeyAlgorithm hash;
-// The length (in bits) of the key.
-required unsigned long length;
+  // The inner hash function to use.
+  required KeyAlgorithm hash;
+  // The length (in bits) of the key.
+  required unsigned long length;
 };
 
+
 dictionary HmacKeyGenParams : Algorithm {
-// The inner hash function to use.
-required HashAlgorithmIdentifier hash;
-// The length (in bits) of the key to generate. If unspecified, the
-// recommended length will be used, which is the size of the associated hash function's block
-// size.
-[EnforceRange] unsigned long length;
+  // The inner hash function to use.
+  required HashAlgorithmIdentifier hash;
+  // The length (in bits) of the key to generate. If unspecified, the
+  // recommended length will be used, which is the size of the associated hash function's block
+  // size.
+  [EnforceRange] unsigned long length;
 };
 
-dictionary HkdfCtrParams : Algorithm {
-// The algorithm to use with HMAC (e.g.: SHA-256)
-required HashAlgorithmIdentifier hash;
-// A bit string that corresponds to the label that identifies the purpose for the derived keying material.
-required BufferSource label;
-// A bit string that corresponds to the context of the key derivation, as described in Section 5 of [NIST SP800-108]
-required BufferSource context;
+
+dictionary HkdfParams : Algorithm {
+  // The algorithm to use with HMAC (e.g.: SHA-256)
+  required HashAlgorithmIdentifier hash;
+  // A bit string that corresponds to the salt used in the extract step.
+  required BufferSource salt;
+  // A bit string that corresponds to the context and application specific context for the derived keying material.
+  required BufferSource info;
 };
 
+
 dictionary Pbkdf2Params : Algorithm {
-required BufferSource salt;
-[EnforceRange] required unsigned long iterations;
-required HashAlgorithmIdentifier hash;
+  required BufferSource salt;
+  [EnforceRange] required unsigned long iterations;
+  required HashAlgorithmIdentifier hash;
 };