lib: add URI handling functions to primordials

PR-URL: https://github.com/nodejs/node/pull/37394
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Antoine du Hamel authored and Michaël Zasso committed 2021-06-11 09:30:00 +02:00
1 parent a4dd50f8f9
commit af39df6d03
6 files changed
+21

No files matched your search

+4
View File
@@ -38,6 +38,10 @@ rules:
- name: Boolean
- name: DataView
- name: Date
- name: decodeURI
- name: decodeURIComponent
- name: encodeURI
- name: encodeURIComponent
- name: Error
ignore:
- prepareStackTrace
+4
View File
@@ -107,6 +107,10 @@ const {
WeakMapPrototype,
WeakSet,
WeakSetPrototype,
decodeURI,
decodeURIComponent,
encodeURI,
encodeURIComponent,
} = primordials;
module.exports = function() {
+10
View File
@@ -173,6 +173,16 @@ primordials.SafeWeakSet = makeSafe(
}
);
// Create copies of URI handling functions
[
decodeURI,
decodeURIComponent,
encodeURI,
encodeURIComponent,
].forEach((fn) => {
primordials[fn.name] = fn;
});
// Create copies of the namespace objects
[
'JSON',
+1
View File
@@ -30,6 +30,7 @@ const {
Symbol,
SymbolIterator,
SymbolToStringTag,
decodeURIComponent,
} = primordials;
const { inspect } = require('internal/util/inspect');
+1
View File
@@ -34,6 +34,7 @@ const {
String,
StringPrototypeCharCodeAt,
StringPrototypeSlice,
decodeURIComponent,
} = primordials;
const { Buffer } = require('buffer');
+1
View File
@@ -27,6 +27,7 @@ const {
ObjectKeys,
SafeSet,
StringPrototypeCharCodeAt,
decodeURIComponent,
} = primordials;
const { toASCII } = require('internal/idna');