diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-23 10:09:05 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-27 19:29:01 +0100 |
commit | 141a6e34eed05577edf43ad085a74f330d0559cb (patch) | |
tree | 1d66ed917d299069b79d34abe1493d18dcb5e138 /lib/internal/per_context | |
parent | 5904dfcc9c70b79971ab09dacd711e5c13d7120c (diff) | |
download | android-node-v8-141a6e34eed05577edf43ad085a74f330d0559cb.tar.gz android-node-v8-141a6e34eed05577edf43ad085a74f330d0559cb.tar.bz2 android-node-v8-141a6e34eed05577edf43ad085a74f330d0559cb.zip |
lib: enforce use of Array from primordials
PR-URL: https://github.com/nodejs/node/pull/30635
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/internal/per_context')
-rw-r--r-- | lib/internal/per_context/primordials.js | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/internal/per_context/primordials.js b/lib/internal/per_context/primordials.js index 6957019490..9e17b3541c 100644 --- a/lib/internal/per_context/primordials.js +++ b/lib/internal/per_context/primordials.js @@ -13,7 +13,6 @@ // by the native module compiler. const ReflectApply = Reflect.apply; -const ReflectConstruct = Reflect.construct; // This function is borrowed from the function with the same name on V8 Extras' // `utils` object. V8 implements Reflect.apply very efficiently in conjunction @@ -120,13 +119,7 @@ primordials.SafePromise = makeSafe( 'WeakSet', ].forEach((name) => { const original = global[name]; - primordials[name] = Object.setPrototypeOf({ - [name]: function(...args) { - return new.target ? - ReflectConstruct(original, args, new.target) : - ReflectApply(original, this, args); - } - }[name], null); + primordials[name] = original; copyPropsRenamed(original, primordials, name); copyPrototype(original.prototype, primordials, `${name}Prototype`); }); |