summaryrefslogtreecommitdiff
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
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.
-rw-r--r--ext/crypto/00_crypto.js7
-rw-r--r--ext/web/13_message_port.js2
-rw-r--r--ext/webidl/00_webidl.js3
3 files changed, 11 insertions, 1 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.
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js
index 7ec8dc9f9..847daba26 100644
--- a/ext/web/13_message_port.js
+++ b/ext/web/13_message_port.js
@@ -231,7 +231,7 @@
transferredArrayBuffers,
});
- for (const i in arrayBufferIdsInTransferables) {
+ for (let i = 0; i < arrayBufferIdsInTransferables.length; ++i) {
const id = arrayBufferIdsInTransferables[i];
transferables[id] = transferredArrayBuffers[i];
}
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js
index dafade99d..c7825b8a2 100644
--- a/ext/webidl/00_webidl.js
+++ b/ext/webidl/00_webidl.js
@@ -1013,6 +1013,9 @@
function configurePrototype(prototype) {
const descriptors = ObjectGetOwnPropertyDescriptors(prototype.prototype);
for (const key in descriptors) {
+ if (!ObjectPrototypeHasOwnProperty(descriptors, key)) {
+ continue;
+ }
if (key === "constructor") continue;
const descriptor = descriptors[key];
if (