lib: use null-prototype objects for property descriptors

PR-URL: https://github.com/nodejs/node/pull/43473
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Antoine du Hamel
2022-06-27 17:29:10 +02:00
committed by GitHub
parent a055337a02
commit bb30e2da7a
3 changed files with 7 additions and 3 deletions

View File

@@ -132,11 +132,13 @@ addBufferPrototypeMethods(Buffer.prototype);
const constants = ObjectDefineProperties({}, {
MAX_LENGTH: {
__proto__: null,
value: kMaxLength,
writable: false,
enumerable: true
},
MAX_STRING_LENGTH: {
__proto__: null,
value: kStringMaxLength,
writable: false,
enumerable: true

View File

@@ -1181,9 +1181,9 @@ function createTeeReadableStream(start, pull, cancel) {
setupReadableStreamDefaultControllerFromSource(
this,
ObjectCreate(null, {
start: { value: start },
pull: { value: pull },
cancel: { value: cancel }
start: { __proto__: null, value: start },
pull: { __proto__: null, value: pull },
cancel: { __proto__: null, value: cancel }
}),
1,
() => 1);

View File

@@ -49,11 +49,13 @@ const kType = Symbol('kType');
const AsyncIterator = ObjectCreate(AsyncIteratorPrototype, {
next: {
__proto__: null,
configurable: true,
enumerable: true,
writable: true,
},
return: {
__proto__: null,
configurable: true,
enumerable: true,
writable: true,