From 156fef9ceae212950f7355d5e3ca8d6e4890cfe0 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Thu, 22 Dec 2022 10:54:38 +0900 Subject: fix(ext): Add checks for owning properties in for-in loops (#17139) In the for-in loops, there were a few places where we forgot to check if objects owned some properties, so I added them. --- ext/crypto/00_crypto.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ext/crypto/00_crypto.js') diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index f56bfb6c0..044cc1f26 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -29,6 +29,7 @@ JSONStringify, MathCeil, ObjectAssign, + ObjectPrototypeHasOwnProperty, ObjectPrototypeIsPrototypeOf, StringPrototypeToLowerCase, StringPrototypeToUpperCase, @@ -211,6 +212,9 @@ // 5. let desiredType = undefined; for (const key in registeredAlgorithms) { + if (!ObjectPrototypeHasOwnProperty(registeredAlgorithms, key)) { + continue; + } if ( StringPrototypeToUpperCase(key) === StringPrototypeToUpperCase(algName) ) { @@ -242,6 +246,9 @@ const dict = simpleAlgorithmDictionaries[desiredType]; // 10. for (const member in dict) { + if (!ObjectPrototypeHasOwnProperty(dict, member)) { + continue; + } const idlType = dict[member]; const idlValue = normalizedAlgorithm[member]; // 3. -- cgit v1.2.3