summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2022-12-22 10:54:38 +0900
committerGitHub <noreply@github.com>2022-12-22 02:54:38 +0100
commit156fef9ceae212950f7355d5e3ca8d6e4890cfe0 (patch)
treee6e43986c639cb09f6bab02380d760a72db575ff /ext/crypto/00_crypto.js
parent4258e06f87f33e1cbf434f5040fc8dfabe254c12 (diff)
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.
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r--ext/crypto/00_crypto.js7
1 files changed, 7 insertions, 0 deletions
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.