1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-23 15:16:54 -05:00

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.
This commit is contained in:
Kenta Moriuchi 2022-12-22 10:54:38 +09:00 committed by Bartek Iwańczuk
parent ee39fb2f27
commit b1cee59fcb
No known key found for this signature in database
GPG key ID: 0C6BCDDC3B3AD750
3 changed files with 11 additions and 1 deletions

View file

@ -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.

View file

@ -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];
}

View file

@ -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 (