diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 83d6855a1cc0a0..af60e4139a4195 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -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 diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index 82720f0ef95aba..0dcfea1ef2ec28 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -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, diff --git a/lib/internal/per_context/primordials.js b/lib/internal/per_context/primordials.js index 2c0df17fbe1170..7d9368e678cc96 100644 --- a/lib/internal/per_context/primordials.js +++ b/lib/internal/per_context/primordials.js @@ -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',