From 7385bafecc1cbf5ff9e1055655b5662c2e5da3dc Mon Sep 17 00:00:00 2001 From: Karthik Ganeshram Date: Tue, 17 Nov 2026 14:00:18 +0100 Subject: [PATCH] Add initial Web Crypto support and QuotaExceededError This is a first step towards a fuller `SubtleCrypto`: it adds the `crypto` global with `getRandomValues` and `randomUUID`, and `subtle.digest` for SHA-1/256/384/512. Also add `QuotaExceededError`, the `DOMException` subclass WebIDL now defines, which `getRandomValues` throws, and enable the matching WPT suites. Signed-off-by: Karthik Ganeshram --- Cargo.lock | 91 +++- Cargo.toml | 4 + crates/builtins/web-crypto/Cargo.toml | 25 + crates/builtins/web-crypto/src/algorithm.rs | 126 +++++ crates/builtins/web-crypto/src/crypto.rs | 121 +++++ crates/builtins/web-crypto/src/lib.rs | 19 + .../builtins/web-crypto/src/subtle_crypto.rs | 68 +++ crates/builtins/web-crypto/tests/crypto.rs | 86 ++++ .../builtins/web-globals/src/dom_exception.rs | 24 +- crates/builtins/web-globals/src/lib.rs | 2 + .../web-globals/src/quota_exceeded_error.rs | 115 +++++ crates/builtins/web-globals/tests/globals.rs | 62 +++ crates/libstarling/Cargo.toml | 1 + crates/libstarling/src/lib.rs | 1 + scripts/test-gc-zeal.sh | 2 +- .../digest/digest.https.any.js.json | 350 +++++++++++++ .../WebCryptoAPI/getRandomValues.any.js.json | 119 +++++ .../WebCryptoAPI/idlharness.https.any.js.json | 248 +++++++++ .../WebCryptoAPI/randomUUID.https.any.js.json | 11 + .../webidl/idlharness.any.js.json | 479 ++++++++++++++++++ tests/wpt-harness/tests.json | 5 + 21 files changed, 1950 insertions(+), 9 deletions(-) create mode 100644 crates/builtins/web-crypto/Cargo.toml create mode 100644 crates/builtins/web-crypto/src/algorithm.rs create mode 100644 crates/builtins/web-crypto/src/crypto.rs create mode 100644 crates/builtins/web-crypto/src/lib.rs create mode 100644 crates/builtins/web-crypto/src/subtle_crypto.rs create mode 100644 crates/builtins/web-crypto/tests/crypto.rs create mode 100644 crates/builtins/web-globals/src/quota_exceeded_error.rs create mode 100644 tests/wpt-harness/expectations/WebCryptoAPI/digest/digest.https.any.js.json create mode 100644 tests/wpt-harness/expectations/WebCryptoAPI/getRandomValues.any.js.json create mode 100644 tests/wpt-harness/expectations/WebCryptoAPI/idlharness.https.any.js.json create mode 100644 tests/wpt-harness/expectations/WebCryptoAPI/randomUUID.https.any.js.json create mode 100644 tests/wpt-harness/expectations/webidl/idlharness.any.js.json diff --git a/Cargo.lock b/Cargo.lock index f287f667..1270e7b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -171,6 +171,15 @@ version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.20.3" @@ -261,7 +270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.3.1", "rand_core", ] @@ -421,6 +430,15 @@ dependencies = [ "mozjs_sys", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "cpufeatures" version = "0.3.1" @@ -445,6 +463,16 @@ version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "dashmap" version = "6.2.1" @@ -465,6 +493,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "diplomat" version = "0.14.0" @@ -775,6 +813,16 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.17" @@ -1524,6 +1572,7 @@ dependencies = [ "tempfile", "tokio", "url", + "web-crypto", "web-encoding", "web-fetch", "web-globals", @@ -2459,6 +2508,28 @@ dependencies = [ name = "serve-test-support" version = "0.3.0" +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -2920,6 +2991,12 @@ dependencies = [ "ryu", ] +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + [[package]] name = "walkdir" version = "2.5.0" @@ -3079,6 +3156,18 @@ dependencies = [ "semver", ] +[[package]] +name = "web-crypto" +version = "0.3.0" +dependencies = [ + "core-runtime", + "getrandom 0.4.3", + "js", + "sha1", + "sha2", + "web-globals", +] + [[package]] name = "web-encoding" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index 4180ccb8..b8163895 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ form_urlencoded = "1.2" futures-channel = "0.3" futures-lite = "2" futures-util = "0.3" +getrandom = "0.4" heck = "0.5" http = "1" http-body = "1" @@ -44,6 +45,8 @@ platform = { path = "crates/platform" } reqwest = { version = "0.13", default-features = false, features = ["rustls", "stream"] } semver = "1.0.28" serve-test-support = { path = "crates/serve-test-support" } +sha1 = "0.10" +sha2 = "0.10" slab = "0.4.12" smallvec = "1.16" starling-macro = { path = "crates/starling-macro" } @@ -67,6 +70,7 @@ web-globals = { path = "crates/builtins/web-globals" } web-streams = { path = "crates/builtins/web-streams" } web-url = { path = "crates/builtins/web-url" } cpp-builtins = { path = "crates/builtins/cpp-builtins" } +web-crypto = { path = "crates/builtins/web-crypto" } web-encoding = { path = "crates/builtins/web-encoding" } [profile.release] diff --git a/crates/builtins/web-crypto/Cargo.toml b/crates/builtins/web-crypto/Cargo.toml new file mode 100644 index 00000000..63aaf920 --- /dev/null +++ b/crates/builtins/web-crypto/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "web-crypto" +version.workspace = true +repository.workspace = true +license.workspace = true +authors.workspace = true +edition.workspace = true + +[features] +debugmozjs = ["js/debugmozjs"] + +[lib] +# No unit tests. This skips building the (SpiderMonkey-sized) lib test harness binary. +test = false + +[dependencies] +core-runtime.workspace = true +getrandom.workspace = true +js.workspace = true +sha1.workspace = true +sha2.workspace = true +web-globals.workspace = true + +[lints] +workspace = true diff --git a/crates/builtins/web-crypto/src/algorithm.rs b/crates/builtins/web-crypto/src/algorithm.rs new file mode 100644 index 00000000..5c8d2ff2 --- /dev/null +++ b/crates/builtins/web-crypto/src/algorithm.rs @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: Apache-2.0-WITH-LLVM-exception + +//! Algorithm identifiers and +//! , for the +//! "digest" operation, the only one implemented so far. (Numbers like "Step 2.5" count the +//! items of the spec's nested list in order.) + +use core_runtime::webidl_union; +use js::conversion::FromJSVal; +use js::error::{throw_type_error, ExnThrown}; +use js::gc::scope::Scope; +use js::Object; +use sha1::Sha1; +use sha2::{Digest, Sha256, Sha384, Sha512}; +use web_globals::dom_exception::throw_dom_exception; + +/// +/// +/// `(object or DOMString)`. An object stands for an `Algorithm` dictionary, whose only member is +/// the required `name`. +#[webidl_union] +pub enum AlgorithmIdentifier<'a> { + Object(Object<'a>), + Name(String), +} + +/// The hash functions `digest()` supports. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum HashAlgorithm { + Sha1, + Sha256, + Sha384, + Sha512, +} + +impl HashAlgorithm { + /// The `supportedAlgorithms` entries for "digest", looked up by case-insensitive match. + fn from_name(name: &str) -> Option { + match name.to_ascii_uppercase().as_str() { + "SHA-1" => Some(Self::Sha1), + "SHA-256" => Some(Self::Sha256), + "SHA-384" => Some(Self::Sha384), + "SHA-512" => Some(Self::Sha512), + _ => None, + } + } + + /// The digest operation's result for each hash function: the message digest of _data_. + pub fn digest(self, data: &[u8]) -> Vec { + match self { + Self::Sha1 => Sha1::digest(data).to_vec(), + Self::Sha256 => Sha256::digest(data).to_vec(), + Self::Sha384 => Sha384::digest(data).to_vec(), + Self::Sha512 => Sha512::digest(data).to_vec(), + } + } +} + +/// , with _op_ +/// fixed to "digest", whose `supportedAlgorithms` are the four SHA functions. None of them has +/// members beyond `name`, so their _desiredType_ is the plain `Algorithm` dictionary. +pub fn normalize_digest_algorithm( + scope: &Scope<'_>, + identifier: AlgorithmIdentifier<'_>, +) -> Result { + // Step 1: If _alg_ is an instance of a DOMString: Return the result of running the + // `normalize an algorithm` algorithm, with _alg_ set to a new `Algorithm` + // dictionary whose `name` attribute is _alg_, and with _op_ set to _op_. + // (For that new dictionary, steps 2.1-2.4 just yield _alg_ as _algName_, so this + // skips straight to step 2.5.) + let alg_name = match identifier { + AlgorithmIdentifier::Name(name) => name, + // Step 2: If _alg_ is an object: + AlgorithmIdentifier::Object(object) => { + // Step 2.1: Let _registeredAlgorithms_ be the associative container stored at the + // _op_ key of `supportedAlgorithms`. + // (That is `HashAlgorithm::from_name`.) + // Step 2.2: Let _initialAlg_ be the result of converting the ECMAScript object + // represented by _alg_ to the IDL dictionary type `Algorithm`. + // Step 2.3: If an error occurred, return the error and terminate this algorithm. + // (`name` is a required member, so a missing one is a `TypeError`.) + let value = object.get_property(scope, c"name")?; + if value.is_undefined() { + return Err(throw_type_error( + scope, + c"Algorithm: Missing required property 'name'", + )); + } + // Step 2.4: Let _algName_ be the value of the `name` attribute of _initialAlg_. + String::from_jsval_throwing(scope, value, Default::default())? + } + }; + // Step 2.5: If _registeredAlgorithms_ contains a key that is a `case-insensitive` string + // match for _algName_: set _algName_ to the value of the matching key and let + // _desiredType_ be the IDL dictionary type stored at _algName_ in + // _registeredAlgorithms_. Otherwise: return a new `NotSupportedError` and + // terminate this algorithm. + let Some(hash) = HashAlgorithm::from_name(&alg_name) else { + return Err(throw_dom_exception( + scope, + "NotSupportedError", + &format!("Unrecognized algorithm name: {alg_name}"), + )); + }; + // Step 2.6: Let _normalizedAlgorithm_ be the result of converting the ECMAScript object + // represented by _alg_ to the IDL dictionary type _desiredType_. + // Step 2.7: Set the `name` attribute of _normalizedAlgorithm_ to _algName_. + // Step 2.8: If an error occurred, return the error and terminate this algorithm. + // (_desiredType_ is `Algorithm` itself, already converted by steps 2.2-2.3. The + // returned `HashAlgorithm` stands for the matched key.) + // Step 2.9: Let _dictionaries_ be a list consisting of the IDL dictionary type _desiredType_ + // and all of _desiredType_'s inherited dictionaries, in order from least to most + // derived. + // Step 2.10: For each dictionary _dictionary_ in _dictionaries_, for each dictionary member + // _member_ declared on _dictionary_, in order: if _member_ is of the type + // `BufferSource` and is present, replace its value with the result of `getting a + // copy of the bytes held by` it; if it is of the type `HashAlgorithmIdentifier`, + // replace its value with the result of `normalizing an algorithm` with _op_ set to + // "digest"; if it is of the type `AlgorithmIdentifier`, replace its value with the + // result of `normalizing an algorithm` with _op_ set to the operation defined by + // the specification that defines the algorithm identified by _algName_. + // (`Algorithm` has only `name`, so there is nothing to do.) + // Step 2.11: If an error occurred, return the error and terminate this algorithm. + // Step 2.12: Return _normalizedAlgorithm_. + Ok(hash) +} diff --git a/crates/builtins/web-crypto/src/crypto.rs b/crates/builtins/web-crypto/src/crypto.rs new file mode 100644 index 00000000..fbeb816d --- /dev/null +++ b/crates/builtins/web-crypto/src/crypto.rs @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: Apache-2.0-WITH-LLVM-exception + +//! + +use std::fmt::Write as _; + +use core_runtime::{webidl_interface, webidl_methods}; +use js::gc::handle::Heap; +use js::gc::scope::Scope; +use js::{ArrayBufferView, Object}; +use web_globals::dom_exception::DOMExceptionError; + +use crate::subtle_crypto::{SubtleCrypto, SubtleCryptoImpl}; + +/// +#[webidl_interface] +pub struct Crypto { + /// + subtle: Heap, +} + +/// The most bytes `getRandomValues` fills in one call. +const MAX_RANDOM_BYTES: usize = 65536; + +#[webidl_methods] +impl Crypto<'_> { + /// + #[getter] + fn subtle<'r>(&self, scope: &'r Scope<'_>) -> SubtleCrypto<'r> { + // The spec gives no steps: the attribute "provides an instance of the `SubtleCrypto` + // interface". That instance is created once, with `crypto`, and returned every time. + self.data().subtle.get(scope) + } + + /// + #[method] + fn get_random_values<'r>( + &self, + array: ArrayBufferView<'r>, + ) -> Result, DOMExceptionError> { + // Step 1: If _array_ is not an `Int8Array`, `Uint8Array`, `Uint8ClampedArray`, + // `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `BigInt64Array`, or + // `BigUint64Array`, then `throw` a `TypeMismatchError` and terminate the + // algorithm. + use js::typedarray::ViewKind::*; + if !matches!( + array.view_kind(), + Int8 | Uint8 | Uint8Clamped | Int16 | Uint16 | Int32 | Uint32 | BigInt64 | BigUint64 + ) { + return Err(DOMExceptionError::new( + "TypeMismatchError", + "The data argument must be an integer-type TypedArray", + )); + } + // Step 2: Let _byteLength_ be the byte length of _array_. + // Step 3: If _byteLength_ is greater than 65536, `throw` a `QuotaExceededError` and + // terminate the algorithm. + // (`throw_dom_exception` turns this name into the `QuotaExceededError` subclass. + if array.byte_length() > MAX_RANDOM_BYTES { + return Err(DOMExceptionError::new( + "QuotaExceededError", + "The ArrayBufferView's byte length exceeds the number of bytes of entropy available via this API (65536)", + )); + } + // Step 4: Let _bytes_ be a byte sequence of length _byteLength_. + // Step 5: Fill _bytes_ with cryptographically secure random bytes. + // Step 6: Write _bytes_ into _array_. + // (Filling _array_'s own bytes in place is the same without the intermediate copy.) + let mut result = Ok(()); + array.with_bytes_mut(|bytes| result = getrandom::fill(bytes)); + result.map_err(|e| DOMExceptionError::new("OperationError", e.to_string()))?; + // Step 7: Return _array_. + Ok(array) + } + + /// + #[method(name = "randomUUID")] + fn random_uuid(&self) -> Result { + // Step 1: Let _bytes_ be a byte sequence of length 16. + let mut bytes = [0u8; 16]; + // Step 2: Fill _bytes_ with cryptographically secure random bytes. + getrandom::fill(&mut bytes) + .map_err(|e| DOMExceptionError::new("OperationError", e.to_string()))?; + // Step 3: Set the 4 most significant bits of _bytes_[6], which represent the UUID + // version, to 0100. + // Step 4: Set the 2 most significant bits of _bytes_[8], which represent the UUID + // variant, to 10. + bytes[6] = (bytes[6] & 0x0f) | 0x40; + bytes[8] = (bytes[8] & 0x3f) | 0x80; + // Step 5: Return the string concatenation of « the hexadecimal representation of + // _bytes_[0] through _bytes_[3], "-", that of _bytes_[4] and _bytes_[5], "-", + // that of _bytes_[6] and _bytes_[7], "-", that of _bytes_[8] and _bytes_[9], "-", + // and that of _bytes_[10] through _bytes_[15] ». + // (A "-" goes in before bytes 4, 6, 8 and 10; each byte is two lowercase digits.) + let mut out = String::with_capacity(36); + for (i, b) in bytes.iter().enumerate() { + if matches!(i, 4 | 6 | 8 | 10) { + out.push('-'); + } + write!(out, "{b:02x}").expect("writing to a String doesn't fail"); + } + Ok(out) + } +} + +/// Register `Crypto` and `SubtleCrypto` on `global` and install the `crypto` singleton. +pub fn add_to_global<'s>(scope: &'s Scope<'_>, global: Object<'s>) { + Crypto::add_to_global(scope, global); + + let subtle = + js::class::create_instance_with::(scope, |_| SubtleCryptoImpl {}) + .expect("failed to allocate SubtleCrypto singleton"); + let crypto = js::class::create_instance_with::(scope, |_| CryptoImpl { + subtle: Heap::from(subtle), + }) + .expect("failed to allocate Crypto singleton"); + + global + .set_property(scope, c"crypto", crypto) + .expect("failed to define globalThis.crypto"); +} diff --git a/crates/builtins/web-crypto/src/lib.rs b/crates/builtins/web-crypto/src/lib.rs new file mode 100644 index 00000000..8eb91384 --- /dev/null +++ b/crates/builtins/web-crypto/src/lib.rs @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: Apache-2.0-WITH-LLVM-exception + +//! Web Cryptography API +//! +//! +//! Provides the `crypto` global (`Crypto`) and `SubtleCrypto`. Supported so far: +//! `getRandomValues`, `randomUUID`, and `subtle.digest`. + +mod algorithm; +mod crypto; +mod subtle_crypto; + +use js::gc::scope::Scope; +use js::Object; + +pub fn add_to_global(scope: &Scope<'_>, global: Object<'_>) { + subtle_crypto::SubtleCrypto::add_to_global(scope, global); + crypto::add_to_global(scope, global); +} diff --git a/crates/builtins/web-crypto/src/subtle_crypto.rs b/crates/builtins/web-crypto/src/subtle_crypto.rs new file mode 100644 index 00000000..071c92e6 --- /dev/null +++ b/crates/builtins/web-crypto/src/subtle_crypto.rs @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: Apache-2.0-WITH-LLVM-exception + +//! + +use core_runtime::{webidl_interface, webidl_methods, webidl_union}; +use js::error::ExnThrown; +use js::gc::scope::Scope; +use js::{ArrayBuffer, ArrayBufferView, Promise}; + +use crate::algorithm::{normalize_digest_algorithm, AlgorithmIdentifier}; + +/// +#[webidl_interface] +pub struct SubtleCrypto {} + +/// +#[webidl_union] +pub enum BufferSource<'a> { + View(ArrayBufferView<'a>), + Buffer(ArrayBuffer<'a>), +} + +#[webidl_methods] +impl SubtleCrypto<'_> { + /// + #[method] + fn digest<'r>( + &self, + scope: &'r Scope<'_>, + algorithm: AlgorithmIdentifier<'_>, + data: BufferSource<'_>, + ) -> Result, ExnThrown> { + // Step 1: Let _algorithm_ be the algorithm parameter passed to the `digest()` method. + // Step 2: Let _normalizedAlgorithm_ be the result of `normalizing an algorithm`, with + // _alg_ set to _algorithm_ and _op_ set to "digest". + // Step 3: If an error occurred, return a Promise rejected with _normalizedAlgorithm_. + // (The `Err` returned here is turned into that rejected promise by + // `#[webidl_methods]`, as for any error from a promise-returning operation.) + let hash = normalize_digest_algorithm(scope, algorithm)?; + // Step 4: Let _data_ be the result of `getting a copy of the bytes held by` the _data_ + // parameter passed to the `digest()` method. + // (The order is observable: a `name` getter run in step 2 can detach or modify + // _data_, so the copy must come after it.) + let data = match data { + BufferSource::View(view) => view.copy_bytes(scope)?, + BufferSource::Buffer(buffer) => buffer.copy_bytes(scope)?, + }; + // Step 5: Let _realm_ be the `relevant realm` of `this`. + // (The result below is created in the current realm, which is `this`'s relevant + // realm as long as there is only one realm.) + // Step 6: Let _promise_ be a new Promise. + // Step 7: Return _promise_ and perform the remaining steps `in parallel`. + // Step 8: If the following steps or referenced procedures say to `throw an error`, + // `queue a global task` to reject _promise_ with the returned error, and then + // terminate the algorithm. + // (Nothing below can fail but allocation.) + // Step 9: Let _digest_ be the result of performing the digest operation specified by + // _normalizedAlgorithm_ using _algorithm_, with _data_ as _message_. + // Step 10: `Queue a global task` to perform the remaining steps. + // Step 11: Let _result_ be the result of `creating an ArrayBuffer` in _realm_, + // containing _digest_. + // Step 12: Resolve _promise_ with _result_. + // (SHA over an in-memory buffer is cheap next to scheduling it, so steps 7-10 run inline + // and the returned promise is already resolved.) + let result = ArrayBuffer::with_data(scope, &hash.digest(&data))?; + Promise::new_resolved_with_value(scope, result) + } +} diff --git a/crates/builtins/web-crypto/tests/crypto.rs b/crates/builtins/web-crypto/tests/crypto.rs new file mode 100644 index 00000000..ca212940 --- /dev/null +++ b/crates/builtins/web-crypto/tests/crypto.rs @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: Apache-2.0-WITH-LLVM-exception + +//! Implementation-specific checks not covered by the WebCryptoAPI WPT suite: the ordering of +//! `digest()`'s steps where script can run in between, and the error types it rejects with. + +#![cfg(not(target_arch = "wasm32"))] + +use core_runtime::runtime::{clear_global_initializers, register_global_initializer}; +use core_runtime::test_util::eval_out_with_setup; + +fn setup() { + clear_global_initializers(); + register_global_initializer(web_globals::add_to_global); + register_global_initializer(web_crypto::add_to_global); +} + +fn eval_out(code: &str) -> String { + eval_out_with_setup(setup, code) +} + +/// Step 4 (copy the bytes) runs after step 2 (normalize the algorithm), so a `name` getter that +/// detaches the buffer leaves nothing to hash: the result is SHA-256 of the empty message. +#[test] +fn digest_copies_data_after_normalizing() { + assert_eq!( + eval_out( + r#" + const data = new Uint8Array([1, 2, 3]); + const alg = { get name() { data.buffer.transfer(); return "SHA-256"; } }; + crypto.subtle.digest(alg, data).then( + buf => { + globalThis.__out = Array.from(new Uint8Array(buf), + b => b.toString(16).padStart(2, "0")).join(""); + }, + e => { globalThis.__out = String(e); }); + "# + ), + "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + ); +} + +/// Errors from normalizing the algorithm and from converting the arguments reject the returned +/// promise instead of throwing synchronously. +#[test] +fn digest_rejects_instead_of_throwing() { + assert_eq!( + eval_out( + r#" + const data = new Uint8Array(1); + const calls = [ + () => crypto.subtle.digest("MD5", data), + () => crypto.subtle.digest({}, data), + () => crypto.subtle.digest({ get name() { throw new SyntaxError(); } }, data), + () => crypto.subtle.digest("SHA-256", "not a buffer"), + () => crypto.subtle.digest("SHA-256"), + ]; + Promise.all(calls.map(call => { + let promise; + try { promise = call(); } catch (e) { return "threw " + e.name; } + return promise.then(() => "resolved", e => e.name); + })).then(names => { globalThis.__out = names.join(); }); + "# + ), + "NotSupportedError,TypeError,SyntaxError,TypeError,TypeError" + ); +} + +/// `getRandomValues`'s `QuotaExceededError` is the `DOMException` subclass, not a plain +/// `DOMException` with that name. +#[test] +fn get_random_values_throws_quota_exceeded_error_subclass() { + assert_eq!( + eval_out( + r#" + try { + crypto.getRandomValues(new Uint8Array(65537)); + globalThis.__out = "no throw"; + } catch (e) { + globalThis.__out = [e instanceof QuotaExceededError, e instanceof DOMException, + e.name, e.code, e.quota, e.requested].join(); + } + "# + ), + "true,true,QuotaExceededError,22,," + ); +} diff --git a/crates/builtins/web-globals/src/dom_exception.rs b/crates/builtins/web-globals/src/dom_exception.rs index 4c42cb65..4ad6c4f9 100644 --- a/crates/builtins/web-globals/src/dom_exception.rs +++ b/crates/builtins/web-globals/src/dom_exception.rs @@ -15,6 +15,8 @@ use js::gc::scope::Scope; use js::native::ExceptionStackBehavior; use js::prelude::ToJSVal; +use crate::quota_exceeded_error::QuotaExceededErrorImpl; + /// https://webidl.spec.whatwg.org/#dfn-error-names-table /// /// Maps DOMException error names to their legacy error code values. @@ -139,15 +141,23 @@ impl DOMException { /// Throw a DOMException with the given name and message. /// /// This creates a new DOMException object and sets it as the pending exception. +/// +/// A "QuotaExceededError" is created as a `QuotaExceededError`, the `DOMException` subclass, with a +/// `null` `quota` and `requested`. pub fn throw_dom_exception(scope: &Scope<'_>, name: &str, message: &str) -> ExnThrown { - let exception = match DOMException::new(scope, message.into(), name.into()) { - Ok(exc) => exc, - Err(_) => return ExnThrown, + let exc_val = if name == "QuotaExceededError" { + js::class::create_instance_with::(scope, |_| { + QuotaExceededErrorImpl::create(message.into(), None, None) + .expect("no quota or requested to validate") + }) + .map(|exc| exc.to_jsval(scope)) + } else { + DOMException::new(scope, message.into(), name.into()).map(|exc| exc.to_jsval(scope)) }; - - let exc_val = exception - .to_jsval(scope) - .expect("Value conversion doesn't fail"); + let Ok(exc_val) = exc_val else { + return ExnThrown; + }; + let exc_val = exc_val.expect("Value conversion doesn't fail"); js::exception::set_pending(scope, exc_val, ExceptionStackBehavior::Capture) } diff --git a/crates/builtins/web-globals/src/lib.rs b/crates/builtins/web-globals/src/lib.rs index da8ca738..4a008c5f 100644 --- a/crates/builtins/web-globals/src/lib.rs +++ b/crates/builtins/web-globals/src/lib.rs @@ -15,12 +15,14 @@ pub mod dom_exception; pub mod events; pub mod navigator; pub mod performance; +pub mod quota_exceeded_error; pub mod signals; mod structured_clone; pub mod worker_location; pub fn add_to_global(scope: &js::prelude::Scope<'_>, global: js::Object<'_>) { dom_exception::DOMException::add_to_global(scope, global); + quota_exceeded_error::QuotaExceededError::add_to_global(scope, global); events::add_to_global(scope, global); performance::add_to_global(scope, global); signals::add_to_global(scope, global); diff --git a/crates/builtins/web-globals/src/quota_exceeded_error.rs b/crates/builtins/web-globals/src/quota_exceeded_error.rs new file mode 100644 index 00000000..9775e604 --- /dev/null +++ b/crates/builtins/web-globals/src/quota_exceeded_error.rs @@ -0,0 +1,115 @@ +// SPDX-License-Identifier: Apache-2.0-WITH-LLVM-exception + +//! `QuotaExceededError`, a `DOMException` subclass. +//! + +use core_runtime::{webidl_dictionary, webidl_interface, webidl_methods}; +use js::conversion::Finite; +use js::error::RangeError; + +use crate::dom_exception::{DOMException, DOMExceptionImpl}; + +/// +#[webidl_interface(extends = DOMException)] +pub struct QuotaExceededError { + parent: DOMExceptionImpl, + /// + quota: Option, + /// + requested: Option, +} + +/// +/// +/// Both members are restricted `double`s, so NaN and ±Infinity are `TypeError`s during conversion. +#[derive(Default)] +#[webidl_dictionary] +pub struct QuotaExceededErrorOptions { + pub quota: Option>, + pub requested: Option>, +} + +#[webidl_methods] +impl QuotaExceededError { + /// + /// + /// `constructor(optional DOMString message = "", optional QuotaExceededErrorOptions options = {})` + #[constructor] + fn new( + message: Option, + options: Option, + ) -> Result { + let options = options.unwrap_or_default(); + Self::create( + message.unwrap_or_default(), + options.quota, + options.requested, + ) + } + + /// + #[getter] + fn quota(&self) -> Option { + // Step 1: Return `this`'s `quota`. + self.data().quota + } + + /// + #[getter] + fn requested(&self) -> Option { + // Step 1: Return `this`'s `requested`. + self.data().requested + } +} + +impl QuotaExceededErrorImpl { + /// Run the constructor steps: validate _quota_ and _requested_, then build the object's + /// state, whose `DOMException` name is "QuotaExceededError". + /// + /// TODO: Rust code can't yet throw a `QuotaExceededError` with a quota or requested. The only + /// way to throw one is `DOMExceptionError::new("QuotaExceededError", ..)`, which goes through + /// `throw_dom_exception`, and that always passes `None` for both. That's right for + /// `getRandomValues`, whose spec gives no values. When a spec says to "throw a + /// `QuotaExceededError` whose quota is _q_ and requested is _r_" (storage APIs, for example), + /// add an error type such as `QuotaExceededErrorError { message, quota, requested }` that + /// implements `ThrowException`: call `create_instance_with::` with + /// `create(message, quota, requested)` and set the result as the pending exception, as + /// `throw_dom_exception` does. WebIDL forbids specs from passing a _requested_ that is less + /// than _quota_, so that type can `expect` that `create` succeeds. + pub fn create( + message: String, + quota: Option>, + requested: Option>, + ) -> Result { + let (quota, requested) = (quota.map(Finite::get), requested.map(Finite::get)); + // Step 1: Set `this`'s `name` to "QuotaExceededError". + // Step 2: Set `this`'s `message` to _message_. + // (Both are the `DOMException` state built at the end. Throwing before it is + // built is not observable.) + // Step 3: If _options_["``quota``"] is present: + // Step 3.1: If _options_["``quota``"] is less than 0, then `throw` a ``RangeError``. + if quota.is_some_and(|q| q < 0.0) { + return Err(RangeError("quota must not be negative".into())); + } + // Step 3.2: Set `this`'s `quota` to _options_["``quota``"]. + // Step 4: If _options_["``requested``"] is present: + // Step 4.1: If _options_["``requested``"] is less than 0, then `throw` a ``RangeError``. + if requested.is_some_and(|r| r < 0.0) { + return Err(RangeError("requested must not be negative".into())); + } + // Step 4.2: Set `this`'s `requested` to _options_["``requested``"]. + // Step 5: If `this`'s `quota` is not null, `this`'s `requested` is not null, and + // `this`'s `requested` is less than `this`'s `quota`, then `throw` a + // ``RangeError``. + if let (Some(quota), Some(requested)) = (quota, requested) { + if requested < quota { + return Err(RangeError("requested must not be less than quota".into())); + } + } + Ok(Self { + parent: DOMExceptionImpl::new(message, "QuotaExceededError".into()), + quota, + requested, + }) + } +} diff --git a/crates/builtins/web-globals/tests/globals.rs b/crates/builtins/web-globals/tests/globals.rs index aeebeef7..e1bdd520 100644 --- a/crates/builtins/web-globals/tests/globals.rs +++ b/crates/builtins/web-globals/tests/globals.rs @@ -232,6 +232,68 @@ mod throw_exception { } } +/// `QuotaExceededError`'s constructor validation. WPT's `webidl/idlharness.any.js` covers its +/// shape, but not the `RangeError`s or the values the constructor stores. +mod quota_exceeded_error { + use core_runtime::{runtime, test_util::eval_with_setup}; + + fn eval(code: &str) -> String { + eval_with_setup( + || { + runtime::clear_global_initializers(); + runtime::register_global_initializer(web_globals::add_to_global); + }, + code, + ) + } + + #[test] + fn construct_and_inherit() { + assert_eq!( + eval( + r#" + const e = new QuotaExceededError("msg", { quota: 1, requested: 2 }); + const d = new QuotaExceededError(); + [e instanceof DOMException, e instanceof Error, e.name, e.message, e.code, + e.quota, e.requested, d.message === "", d.quota, d.requested, + Object.prototype.toString.call(e)].join() + "# + ), + "true,true,QuotaExceededError,msg,22,1,2,true,,,[object QuotaExceededError]" + ); + } + + #[test] + fn constructor_validates_range() { + assert_eq!( + eval( + r#" + const bad = [{ quota: -1 }, { requested: -1 }, { quota: 5, requested: 4 }]; + bad.map(o => { try { new QuotaExceededError("", o); return "no"; } + catch (e) { return e.constructor.name; } }).join() + "# + ), + "RangeError,RangeError,RangeError" + ); + } + + /// `quota` and `requested` are restricted `double`s: non-finite values fail dictionary + /// conversion with a `TypeError` before the constructor steps run. + #[test] + fn constructor_rejects_non_finite() { + assert_eq!( + eval( + r#" + const bad = [{ quota: NaN }, { requested: Infinity }, { quota: -Infinity }]; + bad.map(o => { try { new QuotaExceededError("", o); return "no"; } + catch (e) { return e.constructor.name; } }).join() + "# + ), + "TypeError,TypeError,TypeError" + ); + } +} + mod performance { use core_runtime::{runtime, test_util::eval_with_setup}; diff --git a/crates/libstarling/Cargo.toml b/crates/libstarling/Cargo.toml index 5d45e20b..c9658d14 100644 --- a/crates/libstarling/Cargo.toml +++ b/crates/libstarling/Cargo.toml @@ -21,6 +21,7 @@ event-listener.workspace = true futures-lite.workspace = true futures-util.workspace = true http.workspace = true +web-crypto.workspace = true web-encoding.workspace = true js.workspace = true platform.workspace = true diff --git a/crates/libstarling/src/lib.rs b/crates/libstarling/src/lib.rs index 7665d058..abb1db75 100644 --- a/crates/libstarling/src/lib.rs +++ b/crates/libstarling/src/lib.rs @@ -26,6 +26,7 @@ pub fn register_builtins() { runtime::register_global_initializer(web_globals::add_to_global); runtime::register_global_initializer(web_streams::add_to_global); runtime::register_global_initializer(web_encoding::add_to_global); + runtime::register_global_initializer(web_crypto::add_to_global); runtime::register_global_initializer(web_url::add_to_global); runtime::register_global_initializer(web_fetch::add_to_global); runtime::register_global_initializer(fetch_event::add_to_global); diff --git a/scripts/test-gc-zeal.sh b/scripts/test-gc-zeal.sh index bb54329b..5c57cd9e 100755 --- a/scripts/test-gc-zeal.sh +++ b/scripts/test-gc-zeal.sh @@ -89,7 +89,7 @@ done if [[ "$PACKAGE_SELECTED" == false ]]; then CARGO_ARGS=( -p js -p core-runtime -p wit-bridge - -p cpp-builtins -p fetch-event -p web-encoding -p web-fetch -p web-globals -p web-streams -p web-url + -p cpp-builtins -p fetch-event -p web-crypto -p web-encoding -p web-fetch -p web-globals -p web-streams -p web-url ${CARGO_ARGS[@]+"${CARGO_ARGS[@]}"} ) fi diff --git a/tests/wpt-harness/expectations/WebCryptoAPI/digest/digest.https.any.js.json b/tests/wpt-harness/expectations/WebCryptoAPI/digest/digest.https.any.js.json new file mode 100644 index 00000000..35b9ba33 --- /dev/null +++ b/tests/wpt-harness/expectations/WebCryptoAPI/digest/digest.https.any.js.json @@ -0,0 +1,350 @@ +{ + "SHA-1 with empty source data": { + "status": "PASS" + }, + "sha-1 with empty source data": { + "status": "PASS" + }, + "Sha-1 with empty source data": { + "status": "PASS" + }, + "SHA-256 with empty source data": { + "status": "PASS" + }, + "sha-256 with empty source data": { + "status": "PASS" + }, + "Sha-256 with empty source data": { + "status": "PASS" + }, + "SHA-384 with empty source data": { + "status": "PASS" + }, + "sha-384 with empty source data": { + "status": "PASS" + }, + "Sha-384 with empty source data": { + "status": "PASS" + }, + "SHA-512 with empty source data": { + "status": "PASS" + }, + "sha-512 with empty source data": { + "status": "PASS" + }, + "Sha-512 with empty source data": { + "status": "PASS" + }, + "SHA-1 with short source data": { + "status": "PASS" + }, + "sha-1 with short source data": { + "status": "PASS" + }, + "Sha-1 with short source data": { + "status": "PASS" + }, + "SHA-1 with short source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-1 with short source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-1 with short source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-1 with short source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-256 with short source data": { + "status": "PASS" + }, + "sha-256 with short source data": { + "status": "PASS" + }, + "Sha-256 with short source data": { + "status": "PASS" + }, + "SHA-256 with short source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-256 with short source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-256 with short source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-256 with short source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-384 with short source data": { + "status": "PASS" + }, + "sha-384 with short source data": { + "status": "PASS" + }, + "Sha-384 with short source data": { + "status": "PASS" + }, + "SHA-384 with short source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-384 with short source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-384 with short source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-384 with short source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-512 with short source data": { + "status": "PASS" + }, + "sha-512 with short source data": { + "status": "PASS" + }, + "Sha-512 with short source data": { + "status": "PASS" + }, + "SHA-512 with short source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-512 with short source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-512 with short source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-512 with short source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-1 with medium source data": { + "status": "PASS" + }, + "sha-1 with medium source data": { + "status": "PASS" + }, + "Sha-1 with medium source data": { + "status": "PASS" + }, + "SHA-1 with medium source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-1 with medium source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-1 with medium source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-1 with medium source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-256 with medium source data": { + "status": "PASS" + }, + "sha-256 with medium source data": { + "status": "PASS" + }, + "Sha-256 with medium source data": { + "status": "PASS" + }, + "SHA-256 with medium source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-256 with medium source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-256 with medium source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-256 with medium source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-384 with medium source data": { + "status": "PASS" + }, + "sha-384 with medium source data": { + "status": "PASS" + }, + "Sha-384 with medium source data": { + "status": "PASS" + }, + "SHA-384 with medium source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-384 with medium source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-384 with medium source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-384 with medium source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-512 with medium source data": { + "status": "PASS" + }, + "sha-512 with medium source data": { + "status": "PASS" + }, + "Sha-512 with medium source data": { + "status": "PASS" + }, + "SHA-512 with medium source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-512 with medium source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-512 with medium source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-512 with medium source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-1 with long source data": { + "status": "PASS" + }, + "sha-1 with long source data": { + "status": "PASS" + }, + "Sha-1 with long source data": { + "status": "PASS" + }, + "SHA-1 with long source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-1 with long source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-1 with long source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-1 with long source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-256 with long source data": { + "status": "PASS" + }, + "sha-256 with long source data": { + "status": "PASS" + }, + "Sha-256 with long source data": { + "status": "PASS" + }, + "SHA-256 with long source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-256 with long source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-256 with long source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-256 with long source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-384 with long source data": { + "status": "PASS" + }, + "sha-384 with long source data": { + "status": "PASS" + }, + "Sha-384 with long source data": { + "status": "PASS" + }, + "SHA-384 with long source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-384 with long source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-384 with long source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-384 with long source data and transferred buffer after call": { + "status": "PASS" + }, + "SHA-512 with long source data": { + "status": "PASS" + }, + "sha-512 with long source data": { + "status": "PASS" + }, + "Sha-512 with long source data": { + "status": "PASS" + }, + "SHA-512 with long source data and altered buffer during call": { + "status": "PASS" + }, + "SHA-512 with long source data and altered buffer after call": { + "status": "PASS" + }, + "SHA-512 with long source data and transferred buffer during call": { + "status": "PASS" + }, + "SHA-512 with long source data and transferred buffer after call": { + "status": "PASS" + }, + "AES-GCM with empty": { + "status": "PASS" + }, + "RSA-OAEP with empty": { + "status": "PASS" + }, + "PBKDF2 with empty": { + "status": "PASS" + }, + "AES-KW with empty": { + "status": "PASS" + }, + "AES-GCM with short": { + "status": "PASS" + }, + "RSA-OAEP with short": { + "status": "PASS" + }, + "PBKDF2 with short": { + "status": "PASS" + }, + "AES-KW with short": { + "status": "PASS" + }, + "AES-GCM with medium": { + "status": "PASS" + }, + "RSA-OAEP with medium": { + "status": "PASS" + }, + "PBKDF2 with medium": { + "status": "PASS" + }, + "AES-KW with medium": { + "status": "PASS" + }, + "AES-GCM with long": { + "status": "PASS" + }, + "RSA-OAEP with long": { + "status": "PASS" + }, + "PBKDF2 with long": { + "status": "PASS" + }, + "AES-KW with long": { + "status": "PASS" + }, + "empty algorithm object with empty": { + "status": "PASS" + }, + "empty algorithm object with short": { + "status": "PASS" + }, + "empty algorithm object with medium": { + "status": "PASS" + }, + "empty algorithm object with long": { + "status": "PASS" + } +} diff --git a/tests/wpt-harness/expectations/WebCryptoAPI/getRandomValues.any.js.json b/tests/wpt-harness/expectations/WebCryptoAPI/getRandomValues.any.js.json new file mode 100644 index 00000000..44bfbd66 --- /dev/null +++ b/tests/wpt-harness/expectations/WebCryptoAPI/getRandomValues.any.js.json @@ -0,0 +1,119 @@ +{ + "Float16 arrays": { + "status": "PASS" + }, + "Float arrays": { + "status": "PASS" + }, + "DataView": { + "status": "PASS" + }, + "Integer array: Int8Array": { + "status": "PASS" + }, + "Large length: Int8Array": { + "status": "PASS" + }, + "Null arrays: Int8Array": { + "status": "PASS" + }, + "Subclass of Int8Array": { + "status": "PASS" + }, + "Integer array: Int16Array": { + "status": "PASS" + }, + "Large length: Int16Array": { + "status": "PASS" + }, + "Null arrays: Int16Array": { + "status": "PASS" + }, + "Subclass of Int16Array": { + "status": "PASS" + }, + "Integer array: Int32Array": { + "status": "PASS" + }, + "Large length: Int32Array": { + "status": "PASS" + }, + "Null arrays: Int32Array": { + "status": "PASS" + }, + "Subclass of Int32Array": { + "status": "PASS" + }, + "Integer array: BigInt64Array": { + "status": "PASS" + }, + "Large length: BigInt64Array": { + "status": "PASS" + }, + "Null arrays: BigInt64Array": { + "status": "PASS" + }, + "Subclass of BigInt64Array": { + "status": "PASS" + }, + "Integer array: Uint8Array": { + "status": "PASS" + }, + "Large length: Uint8Array": { + "status": "PASS" + }, + "Null arrays: Uint8Array": { + "status": "PASS" + }, + "Subclass of Uint8Array": { + "status": "PASS" + }, + "Integer array: Uint8ClampedArray": { + "status": "PASS" + }, + "Large length: Uint8ClampedArray": { + "status": "PASS" + }, + "Null arrays: Uint8ClampedArray": { + "status": "PASS" + }, + "Subclass of Uint8ClampedArray": { + "status": "PASS" + }, + "Integer array: Uint16Array": { + "status": "PASS" + }, + "Large length: Uint16Array": { + "status": "PASS" + }, + "Null arrays: Uint16Array": { + "status": "PASS" + }, + "Subclass of Uint16Array": { + "status": "PASS" + }, + "Integer array: Uint32Array": { + "status": "PASS" + }, + "Large length: Uint32Array": { + "status": "PASS" + }, + "Null arrays: Uint32Array": { + "status": "PASS" + }, + "Subclass of Uint32Array": { + "status": "PASS" + }, + "Integer array: BigUint64Array": { + "status": "PASS" + }, + "Large length: BigUint64Array": { + "status": "PASS" + }, + "Null arrays: BigUint64Array": { + "status": "PASS" + }, + "Subclass of BigUint64Array": { + "status": "PASS" + } +} diff --git a/tests/wpt-harness/expectations/WebCryptoAPI/idlharness.https.any.js.json b/tests/wpt-harness/expectations/WebCryptoAPI/idlharness.https.any.js.json new file mode 100644 index 00000000..7eae6cde --- /dev/null +++ b/tests/wpt-harness/expectations/WebCryptoAPI/idlharness.https.any.js.json @@ -0,0 +1,248 @@ +{ + "idl_test setup": { + "status": "PASS" + }, + "idl_test validation": { + "status": "PASS" + }, + "Partial interface mixin WindowOrWorkerGlobalScope: original interface mixin defined": { + "status": "PASS" + }, + "Partial interface mixin WindowOrWorkerGlobalScope: member names are unique": { + "status": "PASS" + }, + "Partial interface Window: member names are unique": { + "status": "PASS" + }, + "Window includes GlobalEventHandlers: member names are unique": { + "status": "PASS" + }, + "Window includes WindowEventHandlers: member names are unique": { + "status": "PASS" + }, + "Window includes WindowOrWorkerGlobalScope: member names are unique": { + "status": "PASS" + }, + "WorkerGlobalScope includes WindowOrWorkerGlobalScope: member names are unique": { + "status": "PASS" + }, + "Window includes AnimationFrameProvider: member names are unique": { + "status": "PASS" + }, + "Window includes WindowSessionStorage: member names are unique": { + "status": "PASS" + }, + "Window includes WindowLocalStorage: member names are unique": { + "status": "PASS" + }, + "Crypto interface: existence and properties of interface object": { + "status": "PASS" + }, + "Crypto interface object length": { + "status": "PASS" + }, + "Crypto interface object name": { + "status": "PASS" + }, + "Crypto interface: existence and properties of interface prototype object": { + "status": "PASS" + }, + "Crypto interface: existence and properties of interface prototype object's \"constructor\" property": { + "status": "PASS" + }, + "Crypto interface: existence and properties of interface prototype object's @@unscopables property": { + "status": "PASS" + }, + "Crypto interface: attribute subtle": { + "status": "PASS" + }, + "Crypto interface: operation getRandomValues(ArrayBufferView)": { + "status": "PASS" + }, + "Crypto interface: operation randomUUID()": { + "status": "PASS" + }, + "Crypto must be primary interface of crypto": { + "status": "PASS" + }, + "Stringification of crypto": { + "status": "PASS" + }, + "Crypto interface: crypto must inherit property \"subtle\" with the proper type": { + "status": "PASS" + }, + "Crypto interface: crypto must inherit property \"getRandomValues(ArrayBufferView)\" with the proper type": { + "status": "PASS" + }, + "Crypto interface: calling getRandomValues(ArrayBufferView) on crypto with too few arguments must throw TypeError": { + "status": "PASS" + }, + "Crypto interface: crypto must inherit property \"randomUUID()\" with the proper type": { + "status": "PASS" + }, + "CryptoKey interface: existence and properties of interface object": { + "status": "FAIL" + }, + "CryptoKey interface object length": { + "status": "FAIL" + }, + "CryptoKey interface object name": { + "status": "FAIL" + }, + "CryptoKey interface: existence and properties of interface prototype object": { + "status": "FAIL" + }, + "CryptoKey interface: existence and properties of interface prototype object's \"constructor\" property": { + "status": "FAIL" + }, + "CryptoKey interface: existence and properties of interface prototype object's @@unscopables property": { + "status": "FAIL" + }, + "CryptoKey interface: attribute type": { + "status": "FAIL" + }, + "CryptoKey interface: attribute extractable": { + "status": "FAIL" + }, + "CryptoKey interface: attribute algorithm": { + "status": "FAIL" + }, + "CryptoKey interface: attribute usages": { + "status": "FAIL" + }, + "SubtleCrypto interface: existence and properties of interface object": { + "status": "PASS" + }, + "SubtleCrypto interface object length": { + "status": "PASS" + }, + "SubtleCrypto interface object name": { + "status": "PASS" + }, + "SubtleCrypto interface: existence and properties of interface prototype object": { + "status": "PASS" + }, + "SubtleCrypto interface: existence and properties of interface prototype object's \"constructor\" property": { + "status": "PASS" + }, + "SubtleCrypto interface: existence and properties of interface prototype object's @@unscopables property": { + "status": "PASS" + }, + "SubtleCrypto interface: operation encrypt(AlgorithmIdentifier, CryptoKey, BufferSource)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation decrypt(AlgorithmIdentifier, CryptoKey, BufferSource)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation sign(AlgorithmIdentifier, CryptoKey, BufferSource)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation digest(AlgorithmIdentifier, BufferSource)": { + "status": "PASS" + }, + "SubtleCrypto interface: operation generateKey(AlgorithmIdentifier, boolean, sequence)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, sequence)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier, CryptoKey, optional unsigned long?)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation importKey(KeyFormat, (BufferSource or JsonWebKey), AlgorithmIdentifier, boolean, sequence)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation exportKey(KeyFormat, CryptoKey)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier)": { + "status": "FAIL" + }, + "SubtleCrypto interface: operation unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, sequence)": { + "status": "FAIL" + }, + "SubtleCrypto must be primary interface of crypto.subtle": { + "status": "PASS" + }, + "Stringification of crypto.subtle": { + "status": "PASS" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"encrypt(AlgorithmIdentifier, CryptoKey, BufferSource)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling encrypt(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"decrypt(AlgorithmIdentifier, CryptoKey, BufferSource)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling decrypt(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"sign(AlgorithmIdentifier, CryptoKey, BufferSource)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling sign(AlgorithmIdentifier, CryptoKey, BufferSource) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling verify(AlgorithmIdentifier, CryptoKey, BufferSource, BufferSource) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"digest(AlgorithmIdentifier, BufferSource)\" with the proper type": { + "status": "PASS" + }, + "SubtleCrypto interface: calling digest(AlgorithmIdentifier, BufferSource) on crypto.subtle with too few arguments must throw TypeError": { + "status": "PASS" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"generateKey(AlgorithmIdentifier, boolean, sequence)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling generateKey(AlgorithmIdentifier, boolean, sequence) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, sequence)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling deriveKey(AlgorithmIdentifier, CryptoKey, AlgorithmIdentifier, boolean, sequence) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"deriveBits(AlgorithmIdentifier, CryptoKey, optional unsigned long?)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier, CryptoKey, optional unsigned long?) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"importKey(KeyFormat, (BufferSource or JsonWebKey), AlgorithmIdentifier, boolean, sequence)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling importKey(KeyFormat, (BufferSource or JsonWebKey), AlgorithmIdentifier, boolean, sequence) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"exportKey(KeyFormat, CryptoKey)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling exportKey(KeyFormat, CryptoKey) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling wrapKey(KeyFormat, CryptoKey, CryptoKey, AlgorithmIdentifier) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "SubtleCrypto interface: crypto.subtle must inherit property \"unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, sequence)\" with the proper type": { + "status": "FAIL" + }, + "SubtleCrypto interface: calling unwrapKey(KeyFormat, BufferSource, CryptoKey, AlgorithmIdentifier, AlgorithmIdentifier, boolean, sequence) on crypto.subtle with too few arguments must throw TypeError": { + "status": "FAIL" + }, + "Window interface: attribute crypto": { + "status": "FAIL" + } +} diff --git a/tests/wpt-harness/expectations/WebCryptoAPI/randomUUID.https.any.js.json b/tests/wpt-harness/expectations/WebCryptoAPI/randomUUID.https.any.js.json new file mode 100644 index 00000000..9f847c95 --- /dev/null +++ b/tests/wpt-harness/expectations/WebCryptoAPI/randomUUID.https.any.js.json @@ -0,0 +1,11 @@ +{ + "namespace format": { + "status": "PASS" + }, + "version set": { + "status": "PASS" + }, + "variant set": { + "status": "PASS" + } +} diff --git a/tests/wpt-harness/expectations/webidl/idlharness.any.js.json b/tests/wpt-harness/expectations/webidl/idlharness.any.js.json new file mode 100644 index 00000000..a7552878 --- /dev/null +++ b/tests/wpt-harness/expectations/webidl/idlharness.any.js.json @@ -0,0 +1,479 @@ +{ + "idl_test setup": { + "status": "PASS" + }, + "idl_test validation": { + "status": "PASS" + }, + "QuotaExceededError interface: existence and properties of interface object": { + "status": "PASS" + }, + "QuotaExceededError interface object length": { + "status": "PASS" + }, + "QuotaExceededError interface object name": { + "status": "PASS" + }, + "QuotaExceededError interface: existence and properties of interface prototype object": { + "status": "PASS" + }, + "QuotaExceededError interface: existence and properties of interface prototype object's \"constructor\" property": { + "status": "PASS" + }, + "QuotaExceededError interface: existence and properties of interface prototype object's @@unscopables property": { + "status": "PASS" + }, + "QuotaExceededError interface: attribute quota": { + "status": "PASS" + }, + "QuotaExceededError interface: attribute requested": { + "status": "PASS" + }, + "DOMException interface: existence and properties of interface object": { + "status": "PASS" + }, + "DOMException interface object length": { + "status": "PASS" + }, + "DOMException interface object name": { + "status": "PASS" + }, + "DOMException interface: existence and properties of interface prototype object": { + "status": "PASS" + }, + "DOMException interface: existence and properties of interface prototype object's \"constructor\" property": { + "status": "PASS" + }, + "DOMException interface: existence and properties of interface prototype object's @@unscopables property": { + "status": "PASS" + }, + "DOMException interface: attribute name": { + "status": "PASS" + }, + "DOMException interface: attribute message": { + "status": "PASS" + }, + "DOMException interface: attribute code": { + "status": "PASS" + }, + "DOMException interface: constant INDEX_SIZE_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant INDEX_SIZE_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant DOMSTRING_SIZE_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant DOMSTRING_SIZE_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant HIERARCHY_REQUEST_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant HIERARCHY_REQUEST_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant WRONG_DOCUMENT_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant WRONG_DOCUMENT_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_CHARACTER_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_CHARACTER_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant NO_DATA_ALLOWED_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant NO_DATA_ALLOWED_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant NO_MODIFICATION_ALLOWED_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant NO_MODIFICATION_ALLOWED_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant NOT_FOUND_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant NOT_FOUND_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant NOT_SUPPORTED_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant NOT_SUPPORTED_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant INUSE_ATTRIBUTE_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant INUSE_ATTRIBUTE_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_STATE_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_STATE_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant SYNTAX_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant SYNTAX_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_MODIFICATION_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_MODIFICATION_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant NAMESPACE_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant NAMESPACE_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_ACCESS_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_ACCESS_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant VALIDATION_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant VALIDATION_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant TYPE_MISMATCH_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant TYPE_MISMATCH_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant SECURITY_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant SECURITY_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant NETWORK_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant NETWORK_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant ABORT_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant ABORT_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant URL_MISMATCH_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant URL_MISMATCH_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant QUOTA_EXCEEDED_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant QUOTA_EXCEEDED_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant TIMEOUT_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant TIMEOUT_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_NODE_TYPE_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant INVALID_NODE_TYPE_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException interface: constant DATA_CLONE_ERR on interface object": { + "status": "PASS" + }, + "DOMException interface: constant DATA_CLONE_ERR on interface prototype object": { + "status": "PASS" + }, + "DOMException must be primary interface of new DOMException()": { + "status": "PASS" + }, + "Stringification of new DOMException()": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"name\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"message\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"code\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"INDEX_SIZE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"DOMSTRING_SIZE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"HIERARCHY_REQUEST_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"WRONG_DOCUMENT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"INVALID_CHARACTER_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"NO_DATA_ALLOWED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"NO_MODIFICATION_ALLOWED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"NOT_FOUND_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"NOT_SUPPORTED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"INUSE_ATTRIBUTE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"INVALID_STATE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"SYNTAX_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"INVALID_MODIFICATION_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"NAMESPACE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"INVALID_ACCESS_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"VALIDATION_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"TYPE_MISMATCH_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"SECURITY_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"NETWORK_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"ABORT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"URL_MISMATCH_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"QUOTA_EXCEEDED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"TIMEOUT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"INVALID_NODE_TYPE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException() must inherit property \"DATA_CLONE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException must be primary interface of new DOMException(\"my message\")": { + "status": "PASS" + }, + "Stringification of new DOMException(\"my message\")": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"name\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"message\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"code\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"INDEX_SIZE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"DOMSTRING_SIZE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"HIERARCHY_REQUEST_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"WRONG_DOCUMENT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"INVALID_CHARACTER_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"NO_DATA_ALLOWED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"NO_MODIFICATION_ALLOWED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"NOT_FOUND_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"NOT_SUPPORTED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"INUSE_ATTRIBUTE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"INVALID_STATE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"SYNTAX_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"INVALID_MODIFICATION_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"NAMESPACE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"INVALID_ACCESS_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"VALIDATION_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"TYPE_MISMATCH_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"SECURITY_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"NETWORK_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"ABORT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"URL_MISMATCH_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"QUOTA_EXCEEDED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"TIMEOUT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"INVALID_NODE_TYPE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\") must inherit property \"DATA_CLONE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException must be primary interface of new DOMException(\"my message\", \"myName\")": { + "status": "PASS" + }, + "Stringification of new DOMException(\"my message\", \"myName\")": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"name\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"message\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"code\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"INDEX_SIZE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"DOMSTRING_SIZE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"HIERARCHY_REQUEST_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"WRONG_DOCUMENT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"INVALID_CHARACTER_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"NO_DATA_ALLOWED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"NO_MODIFICATION_ALLOWED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"NOT_FOUND_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"NOT_SUPPORTED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"INUSE_ATTRIBUTE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"INVALID_STATE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"SYNTAX_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"INVALID_MODIFICATION_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"NAMESPACE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"INVALID_ACCESS_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"VALIDATION_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"TYPE_MISMATCH_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"SECURITY_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"NETWORK_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"ABORT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"URL_MISMATCH_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"QUOTA_EXCEEDED_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"TIMEOUT_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"INVALID_NODE_TYPE_ERR\" with the proper type": { + "status": "PASS" + }, + "DOMException interface: new DOMException(\"my message\", \"myName\") must inherit property \"DATA_CLONE_ERR\" with the proper type": { + "status": "PASS" + } +} diff --git a/tests/wpt-harness/tests.json b/tests/wpt-harness/tests.json index 669f69e5..96fd0e9c 100644 --- a/tests/wpt-harness/tests.json +++ b/tests/wpt-harness/tests.json @@ -23,6 +23,7 @@ "webidl/ecmascript-binding/es-exceptions/DOMException-constructor-and-prototype.any.js", "webidl/ecmascript-binding/es-exceptions/DOMException-constructor-behavior.any.js", "webidl/ecmascript-binding/es-exceptions/DOMException-custom-bindings.any.js", + "webidl/idlharness.any.js", "service-workers/service-worker/historical.https.any.js", "service-workers/service-worker/ServiceWorkerGlobalScope/fetch-on-the-right-interface.https.any.js", "SKIP(needs CacheStorage + ServiceWorkerContainer) service-workers/idlharness.https.any.js", @@ -165,6 +166,10 @@ "encoding/textencoder-constructor-non-utf.any.js", "encoding/textencoder-utf16-surrogates.any.js", "encoding/unsupported-encodings.any.js", + "WebCryptoAPI/digest/digest.https.any.js", + "WebCryptoAPI/getRandomValues.any.js", + "WebCryptoAPI/idlharness.https.any.js", + "WebCryptoAPI/randomUUID.https.any.js", "fetch/api/headers/headers-basic.any.js", "fetch/api/headers/headers-casing.any.js", "fetch/api/headers/headers-combine.any.js",