Skip to content

Commit f7ea75f

Browse files
aduh95sxa
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 a4969d5 commit f7ea75f

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
@@ -138,6 +138,8 @@ rules:
138138
- name: decodeURIComponent
139139
- name: encodeURI
140140
- name: encodeURIComponent
141+
- name: escape
142+
- name: eval
141143
- name: Error
142144
ignore:
143145
- prepareStackTrace
@@ -181,6 +183,7 @@ rules:
181183
- name: Uint32Array
182184
- name: Uint8Array
183185
- name: Uint8ClampedArray
186+
- name: unescape
184187
- name: URIError
185188
- name: WeakMap
186189
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)