We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node.js is failing the WPT tests added by web-platform-tests/wpt#48243
All the errors appear to be expected "DataError" but got "TypeError", so it looks like Node.js is returning the wrong errors.
expected "DataError" but got "TypeError"
Ref: https://developer.mozilla.org/en-US/docs/Web/API/DOMException#dataerror
The text was updated successfully, but these errors were encountered:
A possible fix is the following diff, but I'm not a webcrypto expert:
diff --git a/lib/internal/crypto/webidl.js b/lib/internal/crypto/webidl.js index ee9b7b69b7..a927fe877b 100644 --- a/lib/internal/crypto/webidl.js +++ b/lib/internal/crypto/webidl.js @@ -317,7 +317,7 @@ converters.KeyFormat = createEnumConverter('KeyFormat', [ 'pkcs8', 'spki', 'jwk', -]); +], 'DataError'); converters.KeyUsage = createEnumConverter('KeyUsage', [ 'encrypt', @@ -328,7 +328,7 @@ converters.KeyUsage = createEnumConverter('KeyUsage', [ 'deriveBits', 'wrapKey', 'unwrapKey', -]); +], 'DataError'); converters['sequence<KeyUsage>'] = createSequenceConverter(converters.KeyUsage); diff --git a/lib/internal/webidl.js b/lib/internal/webidl.js index 9e4b20435b..e811b0e8d0 100644 --- a/lib/internal/webidl.js +++ b/lib/internal/webidl.js @@ -204,7 +204,7 @@ function makeException(message, opts = kEmptyObject) { ); } -function createEnumConverter(name, values) { +function createEnumConverter(name, values, errorName = 'TypeError') { const E = new SafeSet(values); return function(V, opts = kEmptyObject) { @@ -213,7 +213,7 @@ function createEnumConverter(name, values) { if (!E.has(S)) { throw makeException( `value '${S}' is not a valid enum value of type ${name}.`, - { __proto__: null, ...opts, code: 'ERR_INVALID_ARG_VALUE' }); + { __proto__: null, ...opts, code: 'ERR_INVALID_ARG_VALUE', name: errorName }); } return S;
Sorry, something went wrong.
@RedYetiDev #55041
No branches or pull requests
Node.js is failing the WPT tests added by web-platform-tests/wpt#48243
All the errors appear to be
expected "DataError" but got "TypeError"
, so it looks like Node.js is returning the wrong errors.Ref: https://developer.mozilla.org/en-US/docs/Web/API/DOMException#dataerror
The text was updated successfully, but these errors were encountered: