Skip to content

Commit 91a06bd

Browse files
aduh95danielleadams
authored andcommitted
lib: add legacy built-in functions to primordials
PR-URL: #42049 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Mestery <[email protected]>
1 parent 11f747b commit 91a06bd

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

lib/.eslintrc.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ rules:
134134
- name: decodeURIComponent
135135
- name: encodeURI
136136
- name: encodeURIComponent
137+
- name: escape
138+
- name: eval
137139
- name: Error
138140
ignore:
139141
- prepareStackTrace
@@ -177,6 +179,7 @@ rules:
177179
- name: Uint32Array
178180
- name: Uint8Array
179181
- name: Uint8ClampedArray
182+
- name: unescape
180183
- name: URIError
181184
- name: WeakMap
182185
into: Safe

lib/internal/freeze_intrinsics.js

+3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ const {
121121
decodeURIComponent,
122122
encodeURI,
123123
encodeURIComponent,
124+
escape,
124125
globalThis,
126+
unescape,
125127
} = primordials;
126128

127129
const {
@@ -232,6 +234,7 @@ module.exports = function() {
232234

233235
// 19 The Global Object
234236
// 19.2 Function Properties of the Global Object
237+
// eslint-disable-next-line node-core/prefer-primordials
235238
eval,
236239
// eslint-disable-next-line node-core/prefer-primordials
237240
isFinite,

lib/internal/per_context/primordials.js

+9
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ function copyPrototype(src, dest, prefix) {
154154
primordials[fn.name] = fn;
155155
});
156156

157+
// Create copies of legacy functions
158+
[
159+
escape,
160+
eval,
161+
unescape,
162+
].forEach((fn) => {
163+
primordials[fn.name] = fn;
164+
});
165+
157166
// Create copies of the namespace objects
158167
[
159168
'JSON',

0 commit comments

Comments
 (0)