mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
fix(ext/crypto): handle idlValue not being present (#11685)
This commit is contained in:
parent
74d523e924
commit
c6e3f93ebb
1 changed files with 7 additions and 2 deletions
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue