diff options
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r-- | ext/crypto/00_crypto.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 4319f09ba..b341aabe7 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -88,6 +88,7 @@ }; // See https://www.w3.org/TR/WebCryptoAPI/#dfn-normalize-an-algorithm + // 18.4.4 function normalizeAlgorithm(algorithm, op) { if (typeof algorithm == "string") { return normalizeAlgorithm({ name: algorithm }, op); @@ -125,18 +126,22 @@ return { name: algName }; } + // 6. const normalizedAlgorithm = webidl.converters[desiredType](algorithm, { prefix: "Failed to normalize algorithm", context: "passed algorithm", }); + // 7. normalizedAlgorithm.name = algName; + // 9. const dict = simpleAlgorithmDictionaries[desiredType]; + // 10. for (const member in dict) { const idlType = dict[member]; const idlValue = normalizedAlgorithm[member]; - - if (idlType === "BufferSource") { + // 3. + if (idlType === "BufferSource" && idlValue) { normalizedAlgorithm[member] = new Uint8Array( TypedArrayPrototypeSlice( (ArrayBufferIsView(idlValue) ? idlValue.buffer : idlValue), |