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:
parent
ee39fb2f27
commit
b1cee59fcb
3 changed files with 11 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in a new issue