Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: add legacy built-in functions to primordials #42049

Merged
merged 1 commit into from Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/.eslintrc.yaml
Expand Up @@ -138,6 +138,8 @@ rules:
- name: decodeURIComponent
- name: encodeURI
- name: encodeURIComponent
- name: escape
- name: eval
- name: Error
ignore:
- prepareStackTrace
Expand Down Expand Up @@ -181,6 +183,7 @@ rules:
- name: Uint32Array
- name: Uint8Array
- name: Uint8ClampedArray
- name: unescape
- name: URIError
- name: WeakMap
into: Safe
Expand Down
3 changes: 3 additions & 0 deletions lib/internal/freeze_intrinsics.js
Expand Up @@ -122,7 +122,9 @@ const {
decodeURIComponent,
encodeURI,
encodeURIComponent,
escape,
globalThis,
unescape,
} = primordials;

const {
Expand Down Expand Up @@ -231,6 +233,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,
Expand Down
9 changes: 9 additions & 0 deletions lib/internal/per_context/primordials.js
Expand Up @@ -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',
Expand Down