lib: add legacy built-in functions to primordials

PR-URL: https://github.com/nodejs/node/pull/42049
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
This commit is contained in:
Antoine du Hamel authored and Danielle Adams committed 2022-04-23 22:47:01 -04:00
1 parent 11f747b0e4
commit 91a06bd629
3 files changed
+15

No files matched your search

+3
View File
@@ -134,6 +134,8 @@ rules:
- name: decodeURIComponent
- name: encodeURI
- name: encodeURIComponent
- name: escape
- name: eval
- name: Error
ignore:
- prepareStackTrace
@@ -177,6 +179,7 @@ rules:
- name: Uint32Array
- name: Uint8Array
- name: Uint8ClampedArray
- name: unescape
- name: URIError
- name: WeakMap
into: Safe
+3
View File
@@ -121,7 +121,9 @@ const {
decodeURIComponent,
encodeURI,
encodeURIComponent,
escape,
globalThis,
unescape,
} = primordials;
const {
@@ -232,6 +234,7 @@ module.exports = function() {
// 19 The Global Object
// 19.2 Function Properties of the Global Object
// eslint-disable-next-line node-core/prefer-primordials
eval,
// eslint-disable-next-line node-core/prefer-primordials
isFinite,
+9
View File
@@ -154,6 +154,15 @@ function copyPrototype(src, dest, prefix) {
primordials[fn.name] = fn;
});
// Create copies of legacy functions
[
escape,
eval,
unescape,
].forEach((fn) => {
primordials[fn.name] = fn;
});
// Create copies of the namespace objects
[
'JSON',