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 Stewart X Addison committed 2022-03-07 17:23:19 +00:00
1 parent a4969d5c37
commit f7ea75fd0a
3 files changed
+15

No files matched your search

+3
View File
@@ -138,6 +138,8 @@ rules:
- name: decodeURIComponent
- name: encodeURI
- name: encodeURIComponent
- name: escape
- name: eval
- name: Error
ignore:
- prepareStackTrace
@@ -181,6 +183,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',