mirror of
https://github.com/denoland/deno.git
synced 2024-11-27 16:10:57 -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:
parent
ee39fb2f27
commit
b1cee59fcb
3 changed files with 11 additions and 1 deletions
|
@ -29,6 +29,7 @@
|
||||||
JSONStringify,
|
JSONStringify,
|
||||||
MathCeil,
|
MathCeil,
|
||||||
ObjectAssign,
|
ObjectAssign,
|
||||||
|
ObjectPrototypeHasOwnProperty,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
StringPrototypeToLowerCase,
|
StringPrototypeToLowerCase,
|
||||||
StringPrototypeToUpperCase,
|
StringPrototypeToUpperCase,
|
||||||
|
@ -211,6 +212,9 @@
|
||||||
// 5.
|
// 5.
|
||||||
let desiredType = undefined;
|
let desiredType = undefined;
|
||||||
for (const key in registeredAlgorithms) {
|
for (const key in registeredAlgorithms) {
|
||||||
|
if (!ObjectPrototypeHasOwnProperty(registeredAlgorithms, key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
StringPrototypeToUpperCase(key) === StringPrototypeToUpperCase(algName)
|
StringPrototypeToUpperCase(key) === StringPrototypeToUpperCase(algName)
|
||||||
) {
|
) {
|
||||||
|
@ -242,6 +246,9 @@
|
||||||
const dict = simpleAlgorithmDictionaries[desiredType];
|
const dict = simpleAlgorithmDictionaries[desiredType];
|
||||||
// 10.
|
// 10.
|
||||||
for (const member in dict) {
|
for (const member in dict) {
|
||||||
|
if (!ObjectPrototypeHasOwnProperty(dict, member)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const idlType = dict[member];
|
const idlType = dict[member];
|
||||||
const idlValue = normalizedAlgorithm[member];
|
const idlValue = normalizedAlgorithm[member];
|
||||||
// 3.
|
// 3.
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
transferredArrayBuffers,
|
transferredArrayBuffers,
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const i in arrayBufferIdsInTransferables) {
|
for (let i = 0; i < arrayBufferIdsInTransferables.length; ++i) {
|
||||||
const id = arrayBufferIdsInTransferables[i];
|
const id = arrayBufferIdsInTransferables[i];
|
||||||
transferables[id] = transferredArrayBuffers[i];
|
transferables[id] = transferredArrayBuffers[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1013,6 +1013,9 @@
|
||||||
function configurePrototype(prototype) {
|
function configurePrototype(prototype) {
|
||||||
const descriptors = ObjectGetOwnPropertyDescriptors(prototype.prototype);
|
const descriptors = ObjectGetOwnPropertyDescriptors(prototype.prototype);
|
||||||
for (const key in descriptors) {
|
for (const key in descriptors) {
|
||||||
|
if (!ObjectPrototypeHasOwnProperty(descriptors, key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (key === "constructor") continue;
|
if (key === "constructor") continue;
|
||||||
const descriptor = descriptors[key];
|
const descriptor = descriptors[key];
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in a new issue