lib: add URI handling functions to primordials

PR-URL: https://github.com/nodejs/node/pull/37394
Backport-PR-URL: https://github.com/nodejs/node/pull/37859
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel 2021-02-16 14:31:29 +01:00 committed by Richard Lau
parent 93dd799a86
commit 2da24ac302
No known key found for this signature in database
GPG Key ID: C43CEC45C17AB93C
4 changed files with 13 additions and 0 deletions

View File

@ -106,6 +106,16 @@ primordials.SafePromise = makeSafe(
class SafePromise extends Promise {}
);
// Create copies of URI handling functions
[
decodeURI,
decodeURIComponent,
encodeURI,
encodeURIComponent,
].forEach((fn) => {
primordials[fn.name] = fn;
});
// Create copies of the namespace objects
[
'JSON',

View File

@ -14,6 +14,7 @@ const {
Symbol,
SymbolIterator,
SymbolToStringTag,
decodeURIComponent,
} = primordials;
const { inspect } = require('internal/util/inspect');

View File

@ -29,6 +29,7 @@ const {
MathAbs,
ObjectCreate,
ObjectKeys,
decodeURIComponent,
} = primordials;
const { Buffer } = require('buffer');

View File

@ -25,6 +25,7 @@ const {
ObjectCreate,
ObjectKeys,
SafeSet,
decodeURIComponent,
} = primordials;
const { toASCII } = require('internal/idna');